Anyone know how to display many varations of time ie: secs from 1970 or 11:12:00 etc
Printable View
Anyone know how to display many varations of time ie: secs from 1970 or 11:12:00 etc
To get the number of seconds between dates, use DateDiff.
Code:Private Sub Command1_Click()
MsgBox DateDiff("s", 1 / 1 / 1970, Now)
End Sub
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
Thanks for that.
Slight ammendment for those on board
DateDiff("s", #1/1/1970#, Now)
surround the date with #