Skip to content

Instantly share code, notes, and snippets.

@alexmoore
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexmoore/9649559 to your computer and use it in GitHub Desktop.
Save alexmoore/9649559 to your computer and use it in GitHub Desktop.
Iso 8601 Timestamp Long format in Erlang
%% Provides a timestamp like 2014-03-19T19:25:17.779905
DateTime = erlang:now().
{_,_,MicroSec} = DateTime.
{{Year,Month,Day},{Hour,Min,Sec}} = calendar:now_to_universal_time(DateTime).
DateString = io:format("~4..0B-~2..0B-~2..0BT~2..0B:~2..0B:~2..0B.~6..0B",
[Year, Month, Day, Hour, Min, Sec, MicroSec]).
DateString.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment