Convert seconds to time format (24 hourly , If the number of hours is greater than 23, Convert to days )
Enter seconds n(n>0 The integer of )
Convert seconds into time format (24 hourly , If the number of hours is greater than 23, Convert to days , If the number of hours is less than 24, The number of days will not be output ) Such as input :3612 , Output is 01:00:12 Such as input :75612 , Output is 21:00:12 Such as input :162012 , Output is 1 day 21:00:12
162012
1 day 21:00:12
The output format is %02d
a=eval(input())
if a>86400:
d=a//86400
h=a%86400//3600
m=a//60%60
s=a%60
print("{} day {:0>2}:{:0>2}:{:0>2}".format(d,h,m,s))
else:
h=a//3600
m=a//60%60
s=a%60
print("{:0>2}:{:0>2}:{:0>2}".format(h,m,s))Convert seconds to time format (12 hourly )
Enter seconds n(n<86400( Seconds in a day )
Convert seconds into time format (12 hourly ) Such as input :3612 , Output is AM 01:00:12 Such as input :75612 , Output is PM 09:00:12
Be careful AM For the range of :0 second ~43199 second (11:59:59) by AM,(43200 second ~86399 second ) by PM
3612
AM 01:00:12
Time display format method , how 1:0:12 Is shown as 01:00:12 Format
With the formatter printf("%02d:%02d:%02d",h,m,s);
a=eval(input())
if a>43199:
h=a%43200//3600
m=a//60%60
s=a%60
print("PM {:0>2}:{:0>2}:{:0>2}".format(h,m,s))
else:
h=a//3600
m=a//60%60
s=a%60
print("AM {:0>2}:{:0>2}:{:0>2}".format(h,m,s))