Results 1 to 6 of 6

Thread: Add to a date

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Location
    UK
    Posts
    205

    Add to a date

    Can anybody tell me how to add to a date. I think the dates are actually stored as doubles but what i want to know is what a

    second, minute, hour, day, month or year would be.

    i have the following

    Code:
    Dim oldDate as Date
    
    If Now() < oldDate + [what i want to add to the date] Then
      DoEvents
    End If
    Hope you can help

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Use the DateAdd function

  3. #3
    jim mcnamara
    Guest
    look up DateDiff and DateAdd in help.

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    ?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2001
    Location
    UK
    Posts
    205
    Cheers

    I dont have the msdn so what goes in the Interval and Number parts. I presume the Date is the date you want to add the interval or number to?

    Code:
    Function DateAdd(Interval As String, Number As Double, Date)

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Interval is a code that determines what you want to add, e.g. Days, Months, Years etc. Number is how many Interval's you want to add to Date
    The interval argument has these settings:

    Setting Description
    yyyy Year
    q Quarter
    m Month
    y Day of year
    d Day
    w Weekday
    ww Week
    h Hour
    n Minute
    s Second

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