Results 1 to 2 of 2

Thread: date & time calculations question

  1. #1
    NeoZ018
    Guest

    Cool Here's you go

    Inhumanoid,

    This will work.....

    Code:
    Dim myDate, dateElements, theDate
    
    myDate = "2001/6/22/17/30/24"
    dateElements = Split(myDate, "/")
    
    theDate = FormatDateTime(dateElements(1) & "/" & dateElements(2) & "/" & _
        dateElements(0) & " " & dateElements(3) & ":" & _
        dateElements(4) & ":" & dateElements(5), 0)
    
    MsgBox DateDiff("s", theDate, Now)  'Difference in Seconds
    MsgBox DateDiff("n", theDate, Now)  'Difference in Minutes
    MsgBox DateDiff("h", theDate, Now)  'Difference in Hours
    MsgBox DateDiff("ww", theDate, Now) 'Difference by Week of Year
    MsgBox DateDiff("w", theDate, Now)  'Difference by Weekday
    MsgBox DateDiff("d", theDate, Now)  'Difference in Days
    MsgBox DateDiff("y", theDate, Now)  'Difference by Day of Year
    MsgBox DateDiff("w", theDate, Now)  'Difference in Weekday
    MsgBox DateDiff("q", theDate, Now)  'Difference in Quarters
    MsgBox DateDiff("yyyy", theDate, Now)   'Difference in Years

    Tanner

  2. #2
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309
    kewl, that al looks pretty logical :-)

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