CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011

    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:
    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');

  2. #2
    Join Date
    Jul 2005

    Re: converting epoch date

    In the next link you'll find several formulaes to convert epoch time to human readable date


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.