Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def appointment_time_string(time_str):
- import datetime
- a = time_str.split()[0]
- in_time = datetime.datetime.strptime(a,'%I:%M%p')
- start_time = str(datetime.datetime.strftime(in_time, "%H:%M:%S")) + "Z"
- if time_str.split()[3] == 'Today,':
- start_date = datetime.datetime.utcnow().strftime("%Y-%m-%dT")
- elif time_str.split()[3] == 'Tomorrow,':
- today = datetime.date.today( )
- start_date = (today + datetime.timedelta(days=1)).strftime("%Y-%m-%dT")
- appointment_time = str(start_date) + str(start_time)
- return appointment_time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement