Created
April 5, 2012 19:31
-
-
Save thanos/2313452 to your computer and use it in GitHub Desktop.
Convert seconds to a date in erlang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| msToDate(Milliseconds) -> | |
| BaseDate = calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}), | |
| Seconds = BaseDate + (Milliseconds div 1000), | |
| { Date,_Time} = calendar:gregorian_seconds_to_datetime(Seconds), | |
| Date. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment