且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在erlang中将datetime()转换为timestamp()

更新时间:2023-02-08 13:31:06

更正版本:

Seconds = calendar:datetime_to_gregorian_seconds(DateTime) - 62167219200,
%% 62167219200 == calendar:datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}})
{Seconds div 1000000, Seconds rem 1000000, 0}.