Skip to content

Instantly share code, notes, and snippets.

@aerosol
Created May 24, 2011 08:15
Show Gist options
  • Select an option

  • Save aerosol/988319 to your computer and use it in GitHub Desktop.

Select an option

Save aerosol/988319 to your computer and use it in GitHub Desktop.
Erlang & strings - can't hate them
iso_8601_fmt(DateTime) ->
{{Year,Month,Day},{Hour,Min,Sec}} = DateTime,
io_lib:format("~4.10.0B-~2.10.0B-~2.10.0B ~2.10.0B:~2.10.0B:~2.10.0B",
[Year, Month, Day, Hour, Min, Sec]).
ts() ->
io_lib:format("~s", [iso_8601_fmt(erlang:localtime())]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment