Wu Yuxiong - born naturally PYTHON3 development of learning: Date and Time

Import time;   # introduction time module 

ticks = the time.time ()
 Print ( " current time stamp as: " , ticks)
Import Time 

localtime = time.localtime (the time.time ())
 Print ( " Local time is: " , localtime)
import time

localtime = time.asctime( time.localtime(time.time()) )
print ("本地时间为 :", localtime)
Import Time 

# formatted 2016-03-20 11:45:39 form 
Print (The time.strftime ( " % D%% Y-M-% H:% M:% S " , time.localtime ())) 

# Format Sat Mar 28 22:24:24 2016 into the form of 
Print (the time.strftime ( " % A% B% D% H:% M:% S% the Y " , time.localtime ())) 
  
# format string is converted to timestamp 
A = " Sat 28-Mar 2016 22:24:24 " 
Print (time.mktime (the time.strptime (A, " % A% B% D% H:% M:% S% the Y " )))
Import Calendar 

CAL = of the Calendar.MONTH (2016, 1 )
 Print ( " the following output in January 2016 calendar: " )
 Print (CAL)

 

Guess you like

Origin www.cnblogs.com/tszr/p/10965776.html