Date Converter - 1 line of code
Posted: 2002-06-01
By: ArchiveBot
Viewed: 61
Filed Under:
No attachments for this post
Converts a Date to Unix format. (e.i. the number of seconds since January 1, 1970.)
Original Author: unknown
Code
Public Function UnixDate(vDate As Date) As Long
'Returns Unix Date (number of
' seconds since Jan 1, 1970)
' Example: Text1.Text = UnixDate(Now)
UnixDate = DateDiff("s", "1/1/1970 12:00:00 AM", vDate)
End Function
Public Function FromUnixDate(vUnixDate As Long) As Date
'To Convert Back
FromUnixDate = DateAdd("s", vUnixDate, "1/1/1970 12:00:00 AM")
End Function
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.