calendar:system_time_to_rfc3339/2

Erlang/OTP でもう時間に苦労しなくていいんだ!

> calendar:system_time_to_rfc3339(erlang:system_time(second)).
"2019-10-07T22:29:02+09:00"
> calendar:system_time_to_rfc3339(erlang:system_time(second), [{offset, "+09:00"}]).
"2019-10-07T22:29:36+09:00"
> calendar:system_time_to_rfc3339(erlang:system_time(millisecond), [{unit, millisecond}, {offset, "+09:00"}]).
"2019-10-07T22:30:58.547+09:00"
> calendar:system_time_to_rfc3339(erlang:system_time(millisecond), [{unit, millisecond}, {offset, "Z"}]).
"2019-10-07T13:38:32.376Z"
> calendar:system_time_to_rfc3339(erlang:system_time(microsecond), [{unit, microsecond}, {offset, "Z"}]).
"2019-10-07T13:39:17.188199Z"

Written by

Erlang/OTP / 時雨堂 / WebRTC / E2EE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store