I've search a bunch on StackExchange for a solution but nothing does quite what I need. In JavaScript, I'm using the following to calculate UTC time since Jan 1st 1970:
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;
}
What would be the equivalent Python code?
See Question&Answers more detail:os