def time_combined(year,month,day,hour,minute,meridiem):
"""
Time is tricky. So I am following the simple rules;
12:** AM will have the hour changed to 0
1:** AM will not have the hour changed
12:** PM will not have the hour changed
1:** PM will have the hour changed by adding 12
From these simple points, I have constructed the following
if statements to take control of the correct hour.
"""
if meridiem == "AM":
if hour == 12:
hour = 0
else:
if hour < 12:
hour = hour + 12
# Create the final start/end date fields
return datetime.datetime(
year,
month,
day,
hour,
minute
)
评论列表
文章目录