Created
August 4, 2019 03:06
-
-
Save topherPedersen/735397cfa24a4553f21506fd577de22c to your computer and use it in GitHub Desktop.
Get Year Month & Day as Integers from an ISO 8601 Date String
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
date_str = "2017-01-29" | |
year_str = date_str[0] + date_str[1] + date_str[2] + date_str[3] | |
month_str = date_str[5] + date_str[6] | |
day_str = date_str[8] + date_str[9] | |
year_int = int(year_str) | |
month_int = int(month_str) | |
day_int = int(day_str) | |
print(year_int) | |
print(month_int) | |
print(day_int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment