Results 1 to 3 of 3

Thread: [RESOLVED] Calculating Date

  1. #1

    Thread Starter
    Addicted Member riechan's Avatar
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    254

    Resolved [RESOLVED] Calculating Date

    Let's say I have two date values, date1 and date2. date1 stores the date today, and date2 is the result when I subtract 7 days from the date today. Is there any function in VB that makes me get the exact date of the day after I subtract 7 days from it? (ex: if today is 1/22, the output once I subtract 7 days from the date today would be 1/15)
    ====================
    ほんとにどもありがとう!

    Rie Ishida

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Calculating Date

    vb Code:
    1. dim date2 as date = now.adddays(-7)

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Calculating Date

    Code:
            Dim d1 As DateTime = DateTime.Now
            Dim d2 As DateTime = d1.AddDays(-7)
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width