#!/usr/bin/python
#-*-Encoding=utf-8-*-
#DATE: 2018-05-12
""" %y Two-digit year 00-99%y four-digit year 000-9999%m month 01-12%d day 01-31%h Hour (24-hour system that 0~23 point)%I Hour (12-hour 01~12)%M Minutes%s seconds "" "
Print('= = Summary = =')Print('One, Time module') Time.time ()#gets the timestamp of the current timeTime.gmtime ()#gets the format time of international UTC (Tm_year=2018,tm_mon=5 ... ), or you can change the timestamp to Struc_time timeTime.localtime ()#gets the local time format time (struct_time)#Note:#format time so we know the current time is the day of the week or the first of this year#Timestamps are typically used to calculate the time differenceTime.strftime (format="', p_tuple="')#time to format struc_time as a custom format#Print (Time.strftime ('%y-%m-%d%h%m%s ', Time.localtime ()))##2018 -05-12 092320Time.strptime (string="', format="')#formats a specific time as a formatted time Struc_time#Print (Time.strptime (' 2018/05/10 ', '%y/%m/%d '))##time. Struct_time (tm_year=2018, tm_mon=5, tm_mday=10, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=130, tm_ Isdst=-1)Time.clock ()#gets the time that the CPU run program worked, but sleep does not count when the CPU is not workingTime.asctime (p_tuple="')#format Struk_time as a string time such as: ' Sat June 16:26:11 1998 '.Time.ctime (Seconds=none)#format seconds as time stamps as String time: '-->thu Jan 1 08:05:00 1970Time.mktime (p_tuple="')#struc_time Time is gmtime (), localtime () is formatted as a timestampTime.sleep (seconds="')#How many seconds are paused
Python Learning _time Module use