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

posted @ 2014-09-26 10:13  小辉卖疯  阅读(341)  评论(0编辑  收藏  举报