Skip to content

Instantly share code, notes, and snippets.

@HJianBo
Created January 19, 2018 01:58
Show Gist options
  • Save HJianBo/6a7bb6091cbaaa520b957fe831c5ea05 to your computer and use it in GitHub Desktop.
Save HJianBo/6a7bb6091cbaaa520b957fe831c5ea05 to your computer and use it in GitHub Desktop.
Erlang Utils Functions
binmstime() ->
%% The time is EMQ server time
{Year, Mon, Day} = date(),
{Hour, Min, Sec} = time(),
{_, _, MicroSecs} = erlang:timestamp(),
list_to_binary(
lists:flatten(
io_lib:format("~2..0w~2..0w~2..0w~2..0w~2..0w~2..0w~3..0w", [Year,Mon,Day,Hour,Min,Sec,trunc(MicroSecs/1000)]))).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment