【发布时间】:2013-04-03 03:30:36
【问题描述】:
我在 StackExchange 上搜索了一堆解决方案,但没有什么能完全满足我的需要。在 JavaScript 中,我使用以下方法计算自 1970 年 1 月 1 日以来的 UTC 时间:
function UtcNow() {
var now = new Date();
var utc = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds());
return utc;
}
等效的 Python 代码是什么?
【问题讨论】:
-
等等,你用的是 Python 还是 JavaScript?