开始时间以小时(0..23)和分钟(0..59)对的形式给出。
例如,如果某个事件在12:17开始且持续时间为59分钟,那么它将在13:16结束,没有任何时间模块。
答案 0 :(得分:0)
starttime = datetime.datetime(2019, 12, 25, 17, 4) # time now
delta = datetime.timedelta(minutes=5) # could be minutes = whatever
endtime = starttime + delta
答案 1 :(得分:0)
hour = int(input("Starting time (hours): "))
mins = int(input("Starting time (minutes): "))
dura = int(input("Event duration (minutes): "))
mins = mins + dura # find a total of all minutes
hour = hour + mins // 60 # find a number of hours hidden in minutes and update the hour
mins = mins % 60 # correct minutes to fall in the (0..59) range
hour = hour % 24 # correct hours to fall in the (0..23) range
print(hour, ":", mins, Sep='')