Skip to content

Instantly share code, notes, and snippets.

@thanos
Created April 5, 2012 19:31
Show Gist options
  • Select an option

  • Save thanos/2313452 to your computer and use it in GitHub Desktop.

Select an option

Save thanos/2313452 to your computer and use it in GitHub Desktop.
Convert seconds to a date in erlang
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