by C. Alexander (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 11th November 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Turn Time and Date to Epoch Turn Epoch to Time and Date
API Declarations
'** DateToEpoch was originally found at:
'** http://www.vbcode.com/asp/showsn.asp?theID=3476
'** written by Markus Hartsmar
'**
'** I've shortened this function, and added reversal
'**
Public Property Get Epoch() As String
Epoch = DateDiff("s", "00:00:00 1/1/1970", Now)
End Property
Public Property Get DateToEpoch(ByVal MyDate As Date) As String
DateToEpoch = DateDiff("s", "00:00:00 1/1/1970", MyDate)
End Property
Public Property Get EpochToDate(ByVal MyEpoch As String) As Date
EpochToDate = DateAdd("s", MyEpoch, "00:00:00 1/1/1970")
End Property
CurrentEpoch = Epoch
Dim EpochOfDate as String
EpochOfDate = DateToEpoch(Now)
Dim DateofEpoch As Date
DateOfEpoch = EpochToDate(CurrentEpoch)