Ho cercato un mucchio su StackExchange per una soluzione, ma niente fa esattamente quello di cui ho bisogno. In JavaScript, sto usando quanto segue per calcolare il tempo UTC dal 1 gennaio 1970:Come ottenere l'ora UTC in Python?
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;
}
Quale sarebbe il codice Python equivalente?
correlati: [Python: Come ottenere un valore di datetime.today() questo è "timezone aware"?] (http://stackoverflow.com/q/4530069/4279) – jfs