You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12306/utils/timeUtil.py

15 lines
290 B

def time_to_minutes(time_str):
s = time_str.split(":")
a = int(s[0]) * 60 + int(s[1])
return a
def minutes_to_time(minutes):
m = minutes % 60
if m<10:
return str(minutes / 60) + ":" + str("0"+str(m))
else:
return str(minutes / 60) + ":" + str(m)