Created
December 13, 2018 10:32
-
-
Save jerryan999/e7c2587fb0f27a6e05e727067322e3a5 to your computer and use it in GitHub Desktop.
compare normal datetime and timezone-aware datetime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta, timezone | |
TZ_DELTA = 0 # Define timezone, UTC '0' | |
tzinfo = timezone(timedelta(hours=TZ_DELTA)) | |
# timezone-aware datetime | |
now = datetime.now(tz=tzinfo) | |
# normal datetime | |
now = datetime.now() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment