UNIX timestamp to Date function
October 11, 2010 – 5:56 amFor migration project I needed a function to convert a UNIX timestamp to Notes Date /Time. Here is the function I used
Function Timestamp2Date(timestamp As Double) As String Dim dt As New NotesDateTime("01/01/1970 00:00:00") Dim dd As Integer, hh As Integer, ss As Double dd = Fix(timestamp / 86400) ss = (timestamp Mod 86400) Mod 3600 hh = Fix(ss / 3600) hh = hh + 1 Call dt.AdjustDay(dd) Call dt.AdjustHour(hh) Call dt.AdjustSecond(ss) Timestamp2Date = Format(dt.LSLocalTime, "dd/mm/yyyy hh:mm:ss") End Function |
Sub Click(Source As Button) Msgbox Timestamp2Date(1115986380) End Sub |
will convert the UNIX timestamp 1115986380 to “13.05.2005 02:13:00″



Sorry, comments for this entry are closed at this time.