Results 1 to 4 of 4

Thread: time

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Anyone know how to display many varations of time ie: secs from 1970 or 11:12:00 etc

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    Seconds

    To get the number of seconds between dates, use DateDiff.

    Code:
    Private Sub Command1_Click()
        MsgBox DateDiff("s", 1 / 1 / 1970, Now)
    End Sub

  3. #3
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    Format

    You can also use Format on the date.

    Code:
    Private Sub Command1_Click()
        MsgBox DateDiff("s", 1 / 1 / 1970, Now) & vbCrLf & _
        Format(Now, "mm/dd/yy") & vbCrLf & _
        Format(Now, "mm/dd/yyyy") & vbCrLf & _
        Format(Now, "mm:dd:yy") & vbCrLf & _
        Format(Now, "mm:dd:yy  hh:mm:ss")
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Thanks for that.
    Slight ammendment for those on board

    DateDiff("s", #1/1/1970#, Now)

    surround the date with #

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