Created
January 20, 2017 20:24
-
-
Save KameronKales/7cff6295cf9506d7f9edcdc001dfe447 to your computer and use it in GitHub Desktop.
last portion of time formatting needed
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 as dt | |
hour = dt.now().hour | |
for i in str(hour): | |
if hour < 12 and time != '00': | |
current_hour = hour | |
end_hour = current_hour + 1 | |
period = "AM" | |
elif hour < 12 and time == '00': | |
current_hour = (hour + 1) | |
end_hour = (current_hour + 1) | |
period = "AM" | |
elif hour == 12: | |
current_hour = (hour + 1) - 12 | |
end_hour = (current_hour + 1) | |
period = "PM" | |
elif hour > 12 and time == '00': | |
current_hour = (hour + 1) - 12 | |
end_hour = (current_hour + 1) | |
period = "PM" | |
else: | |
hour > 12 | |
current_hour = hour - 12 | |
end_hour = (current_hour + 1) | |
period = "PM" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment