Relative Content

Tag Archive for pythondatetime

What is the default `datetime.now()` timezone?

from datetime import datetime from datetime import timezone print(f’datetime.now(): {datetime.now()}’) print(f’current timezone: {datetime.now().tzinfo}’) # prints `None` As seen in the above code snippet, the default timezone for a datetime object created with datetime.now() is None. My question is how to interpret this? No explicit timezone is set, however the value produced by datetime.now() matches the […]