Last active
August 29, 2015 13:57
-
-
Save alexmoore/9649559 to your computer and use it in GitHub Desktop.
Iso 8601 Timestamp Long format in Erlang
This file contains 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
%% 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