Heim > Fragen und Antworten > Hauptteil
PHP中文网2017-04-18 10:28:50
from datetime import datetime
s = '152753'
t = datetime.strptime(s, '%H%M%S').time()
print(t)
15:27:53
ringa_lee2017-04-18 10:28:50
>>> time = "152753"
>>> ':'.join(time[i:i+2] for i in range(0, len(time), 2))
>>> '15:27:53'
大家讲道理2017-04-18 10:28:50
var time = '152753'
time = time.substring(0,2)+':'+time.substring(2,4)+':'+time.substring(4,6)