calendar:now_to_local_time/1
把当前时间转换为本地日期时间
用法:
now_to_local_time(Now) -> {{year,month,day},{hour,minute,second}}
内部实现:
-spec now_to_local_time(Now) -> datetime1970() when
Now :: erlang:timestamp().
now_to_local_time({MSec, Sec, _uSec}) ->
erlang:universaltime_to_localtime(
now_to_universal_time({MSec, Sec, _uSec})).
这个函数是将当前时间 Now 转换为本地的日期和时间
calendar:now_to_local_time(os:timestamp()).