Skip to Content
Modern Python Standard Library Cookbook
book

Modern Python Standard Library Cookbook

by Alessandro Molina
August 2018
Intermediate to advanced
366 pages
10h 14m
English
Packt Publishing
Content preview from Modern Python Standard Library Cookbook

How it works...

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).

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Matthew Wilkes

Publisher Resources

ISBN: 9781788830829Supplemental Content