我在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;
}
Run Code Online (Sandbox Code Playgroud)
什么是等效的Python代码?