VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Turn Time and Date to Epoch Turn Epoch to Time and Date

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


Rate Turn Time and Date to Epoch Turn Epoch to Time and Date



CurrentEpoch = Epoch

Dim EpochOfDate as String
EpochOfDate = DateToEpoch(Now)

Dim DateofEpoch As Date
DateOfEpoch = EpochToDate(CurrentEpoch)



Download this snippet    Add to My Saved Code

Turn Time and Date to Epoch Turn Epoch to Time and Date Comments

No comments have been posted about Turn Time and Date to Epoch Turn Epoch to Time and Date. Why not be the first to post a comment about Turn Time and Date to Epoch Turn Epoch to Time and Date.

Post your comment

Subject:
Message:
0/1000 characters