Last active
May 12, 2020 16:01
-
-
Save spatialtime/0e1ec9c6df4fd752f8f5bfc05bb9b231 to your computer and use it in GitHub Desktop.
Pythonic formatting and parsing of ISO 8601 weeks.
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
# This snippet demonstrates Pythonic formatting and parsing of | |
# ISO 8601 weeks. | |
# The first ISO week of the year is the first week containing | |
# a Thursday. | |
# ISO weeks begin on Monday, with Monday being day 1. | |
from datetime import datetime | |
d = datetime.strptime("2020-W17-7", "%G-W%V-%u") | |
print(format(d, "%G-W%V-%u")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment