3 ms·
Removing utcnow() doesn't force you to use tz-aware dates though. That's just a leap that the author of this article has made. If you're working in a system
by notatoad 3y ago
Removing utcnow() doesn't force you to use tz-aware dates though. That's just a leap that the author of this article has made.
If you're working in a system where all dates are utc, then datetime.now() gets you a date in utc and you don't need datetime.utcnow(). The only reason to call utcnow is if you're working on a system where the local timezone isn't utc, so you inherently have to deal with timezones at some level. Which means that using naive timestamps is a bad idea.
- nerdponx 3y agodatetime.now(tz=timezone.utc) is what you probably want most of the time anyway. You can always manually strip off the time zone component if you really want to use datetimes without associated time zones.