VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, convert

by Markus Hartsmar (2 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 2nd May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, converted to milliseconds. This small piece lets

API Declarations


Public epoch

Rate Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, convert



 ' *** Just call the function with the epoch value you have.
 ' ***
 ' *** startDate: Is set to January 1st 1970, the start date
 ' *** of the Epoch.
 ' ***
 ' *** seconds: After calculating this holds the total amount
 ' *** of seconds from the epoch.
 ' ***
 ' *** gotDate: Holds the final result.

 

Private Function EpochToDate(epoch)

 Dim seconds
 Dim startDate As Date
 
 startDate = #1/1/1970#
 seconds = CDec(epoch) / 1000                 'Convert milliseconds to seconds
 gotDate = DateAdd("s", seconds, startDate)   'Add seconds to start date
 
End Function


Download this snippet    Add to My Saved Code

Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, convert Comments

No comments have been posted about Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, convert. Why not be the first to post a comment about Many applications store date information based on the epoch, January 1, 1970, 00:00:00 GMT, convert.

Post your comment

Subject:
Message:
0/1000 characters