Epoch time is nothing but the number of milliseconds since January 1, 1970. It can be used in many places as a unique identity. You can use epoch time to provide IDs in a database on the basis of current date and time. It is useful to store date and time since it is short and is just a number. I have created a class which has two functions. One for converting a datetime object to simple epoch time and the other for doing the reverse. The functions are shared functions which don’t need any instance to run. You can call them directly like:
Dim EpochNow As String = Epoch.ConvertDateTimeToEpoch(New Date(2014, 6, 13, 12, 0, 0, 0))
To get the actual date and time from epoch, you can write:
Dim MyDate As Date = Epoch.ConvertEpochToDateTime(1402642978506)
(The epoch time above is the time when I wrote this post).
To download the source file, click here.