August 2018
Intermediate to advanced
366 pages
10h 14m
English
The functioning of this recipe is pretty straightforward, through the datetime.datetime.astimezone method, the date is always converted to its UTC representation.
This ensures it will work for both where your storage keeps track of time zones (as the date will still be time-zone-aware, but the time zone will be UTC) and when your storage doesn't preserve time zones (as a UTC date without a time zone still represents the same UTC date as if the delta was zero).