Python time format

import time

now = time.localtime(time.time())
print time.asctime(now)
print time.strftime("%y %m %d %H:%M", now)
print "*****a,b,c,d********"
print time.strftime("%a", now)
print time.strftime("%b", now)
print time.strftime("%c", now)
print time.strftime("%d", now)
print "*****a,b,c,d********"

print "*********I, p********"
print time.strftime("%I %p", now)
print "*********I, p********"

print time.strftime("%Y-%m-%d %H:%M:%S %Z", now)
print "**********************"

year,month,day,hour,minute,second,weekday,yearday,daylight = now

print ("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN")[weekday], yearday
print weekday

image

原文地址:https://www.cnblogs.com/xhmf/p/3994272.html