-
May 13th, 2011, 01:53 PM
#1
converting epoch date
I have a database that is storing dates in millisecond epoch timestamp format. I cannot figure out how to take this format and turn it into a "calendar" date/time.
Actually I can get the calendar date - just can't get the time to work like it should.
For instance, 1305211842916 should be equal to 5/12/11 9:50:42AM [CST]. I can get the date of 5/12, but the hours don't work out right.
Here's what I've got thus far:
WhilePrintingRecords;
NumberVar StartTotalsec := {A_STARTTIMETS};
NumberVar StartDays := truncate(StartTotalsec/86400);
NumberVar StartHours := truncate(Remainder(StartTotalsec,86400)/3600);
Numbervar StartMinutes := truncate(Remainder(StartTotalsec,3600)/60);
Numbervar StartSeconds := Remainder(StartTotalsec,60);
Totext (StartDays, '##')+'$'+
Totext (StartHours, '00')+':'+
Totext (StartMinutes, '00')+':'+
Totext (StartSeconds, '00');
-
May 13th, 2011, 04:37 PM
#2
Re: converting epoch date
In the next link you'll find several formulaes to convert epoch time to human readable date
http://www.epochconverter.com/
JG
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|