• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Algorithm to determine time given a number of ms

AgentEL

Golden Member
Does anyone know an algorithm that takes the number of ms starting from January 1, 1980?

For example, given 5,000,001 milliseconds since 01/01/1980, what date/time does that translate to in the format MM/DD/YYYY HH:MM:SS.msec?

It seems like there should be a mathematical formula, but I can't seem to figure it out.

Edit: btw, I'm trying to do this in Perl.
 
Divide the value by 1000 to get seconds, and i'm sure you can find some code to convert that into MM/DD/YYY HH:MM:SS format 🙂


Confused
 
/1000 and use the standard time functions for seconds? (then mod 1000 for the last bit)

(edit) several milliseconds too slow 🙂
 
You could use the UNIX epoch and add ten years of milliseconds to your time. There are many algoriths out there that will do that.


I have no idea if this will work, but it might.
 
Originally posted by: notfred
I wonder if anyone ever read that code I wrote...
Looked good to me, but I have no use for it 🙂 -- a little impolite of AgentEL
not to respond or PM since s/he did visit forums after you wrote it.
 
Back
Top