Time Module
and time-related functional modules.
1, time stamp time
# Timestamp time float display 1970 to current number of seconds print(Time.time ()) # 1515584512.4203668
2, Format time
# Format time format displays the current time for easy viewing Print (Time.strftime ('%y/%m/%d%h:%m:%s')) # 2018/01/10 19:48:48 """ %+ Specifies the character: Y represents the year that displays the full year number Y is also the two-bit m that represents the year after the year number is displayed for the month display month D represents the date display what time H represents the hour shows several points 24-hour M stands for minutes showing a few seconds for seconds " " "
3, Structured time
#Structured Time#Show local timePrint(Time.localtime ())"""results: Time.struct_time (tm_year=2018, Tm_mon=1, tm_mday=11, tm_hour=15, tm_min=0, Tm_se C=31, Tm_wday=3, tm_yday=11, tm_isdst=0)"""#Show GMTPrint(Time.gmtime ())"""results: Time.struct_time (tm_year=2018, Tm_mon=1, tm_mday=11, tm_hour=7, tm_min=0, Tm_se C=31, Tm_wday=3, tm_yday=11, tm_isdst=0)"""
The conversion between different format times.
#Timestamp- %a%b%d%h:%m:%s%y string#If no arguments are passed, the current time is returnedPrint(Time.ctime ())#Thu Jan 15:13:56 2018#structured Time--%a%b%d%h:%m:%s%y string#If no arguments are passed, the current time is returnedPrint(Time.asctime ())#Thu Jan 15:17:43 2018#format time--structured time#The format of the time and time of the conversionPrint(Time.strptime ('2018/1/11','%y/%m/%d'))"""results: Time.struct_time (tm_year=2018, Tm_mon=1, tm_mday=11, tm_hour=0, tm_min=0, Tm_se C=0, Tm_wday=3, tm_yday=11, Tm_isdst=-1)"""#structured time-time stamping#parameter is a structured time tuplePrint(Time.mktime (Time.localtime ()))#1515655766.0
The time module of the Python module