#! /usr/bin/env python
#-*-Coding:utf-8-*-
Import time
Print ("111")
Time.sleep (2) #推迟调用线程的运行, secs units are seconds
Print ("222")
Today = Time.time () #返回当前时间的时间戳 (number of floating-point seconds after 1970)
Print (today)
Print (Time.ctime ()) #把一个时间戳转化为time. Asctime () Form. The parameter is not given the default time.time () parameter.
The Print (Time.gmtime (today)) #gmtime () method is a time-tuple t that converts a timestamp to the UTC time zone (0 o'clock Zone).
Print (Time.localtime ()) #将一个时间戳转换为当前时区的时间元组t
SS = Time.strftime ("%y-%m-%d%x") # Formatted date
Print (ss)
tt = time.strptime (ss, '%y-%m-%d%x ') #逆格式化日期
Print (TT)
#time. Strftime (Format[,t])
The #把一个代表时间的元组或者struct_time, as returned by Time.localtime () and Time.gmtime (), are formatted.
# if T is not specified, the Time.localtime () will be passed in, and if an element is appointed out of bounds in the tuple, an ValueError exception will be thrown
#format格式如下:
#%a Native (local) simplified week name
#%A Local Full week name
#%b Local Simplified month name
#%B Local Full month name
#%c local corresponding date and time representation
#%d days of the one month (01-31)
#%H hours of the day (24-hour, 00-23)
#%l hours of the day (12-hour, 01-12)
#%j days of the Year (01-366)
#%m Month (01-12)
#%M minutes (00-59)
#%p Local AM or PM's corresponding character
#%s seconds (01-61)
#%u number of cycles in a year (0-53, Sunday is the beginning of the week, all days before the first Sunday are placed in the No. 0 week)
#%w the day of the one week (0-6,0 is Sunday)
#%W and%u are basically the same, the difference is%W with Monday for one weeks start
#%x Local corresponding date
#%x Local corresponding time
#%y minus the years of the Century (00-99)
#%Y Full Year
#%z with + (-) HHMM to indicate time zone offset from Greenwich (h decimal hour, m decimal minutes)
#%Z The name of the time zone (if it does not exist as a null character)
#% percent of the number itself
#%p only works in conjunction with%i
# when using the Strptime () function,%u and%w are only evaluated when the number of weeks and days in the year is determined
#struct_time元组元素结构
# property value
# tm_year (year) like 2011
# Tm_mon (month) 1-12
# Tm_mday (Sun) 1-31
# Tm_hour (Hours) 0-23
# tm_min (min) 0-59
# tm_sec (sec) 0-61
# Tm_wday (Weekday) 0-6 (0 = Sunday)
# Tm_yday (Day of the year) 1-366
# TM_ISDST (Daylight saving time) default is-1
Python Time module