Home > DeveloperSection > Forums > How to convert timestamp into Date-Time format in Erlang?
Monaj Singh
Monaj Singh

Total Post:41

Posted on    March-22-2016 12:21 AM

 erlang erlang 

 1 Reply(s)
 598  View(s)
Rate this:

I am a beginner in Erlang programming. I have getting problem to convert timestamp format into Date-Time format. Can any one tell me how can I convert timestamp into Date-Time format?
I want to convert {Year, Month, Day} format. please help me.

Tarun Kumar

Total Post:214

Posted on    March-22-2016 1:08 AM

If you want to change timestamp format like {Year, Month, Day}, then you can use this example:
I hope it will solve your problem:
timestampToDate(Milliseconds) ->
  BDate = calendar:datetime_to_gregorian_seconds({{1995,1,1},{0,0,0}}),
  Sec = BDate + (Milliseconds div 1000),
  { Date,_Time} = calendar:gregorian_seconds_to_datetime(Sec),

Modified On Mar-28-2016 12:35:46 AM

Don't want to miss updates? Please click the below button!

Follow MindStick