gpt4 book ai didi

erlang - 如何在 Erlang/OTP 中将 datetime() 转换为 timestamp()?

转载 作者:行者123 更新时间:2023-12-03 23:41:59 25 4
gpt4 key购买 nike

我需要转换 {{2012, 9, 21}, {13, 21, 11}}进入 timestamp() .

我怎样才能做到这一点?

最佳答案

修正版:

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}.

关于erlang - 如何在 Erlang/OTP 中将 datetime() 转换为 timestamp()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12527908/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com