python commonly used time and time module datetime, the following are two methods commonly used modules:
# First module introduced
import time
from datetime import datetiem, timezone, timedelta
# Time Stamp
print ( "show a timestamp:", End = "")
Print (the time.time ())
# Sleep one second
time.sleep (1) # change the number and realize a longer sleep
# Display region
print (time.timezone) # obtained in UTC time minus the current difference, in seconds, such as: -28800 Representative East region 8
# Print local time
Print (DateTime.Now ())
# print UTC London Time
print (datetiem.utcnow ())
# Specified printing time zone
tz = timezone (timedelta (hours = 1)) # East region 1
Print (DateTime.Now (TZ)) # 1 print region east of the current time
tz2 = timezone (timedelta (hours = -1)) # West zone 1
print (datetime.now (tz2)) # print the current time zone west 1
# Output Formatting time
CT = DateTime.Now ()
V1 = ct.strftime ( "% D%% Y-M-% H:% M:% S")
Print (V1)
# String converted into datetime
DATE = "2019-08-06 17:43:55"
V2 = datetime.strptime (DATE, "% Y-M-% D%% H:% M:% S") the # date string format, automatically converted clearly labeled
Print (V2)
#datetime add or subtract
V3 = V2 + timedelta (= 40 Days)
Print (V3)
V4 = V2 - timedelta (=. 5 hours)
Print (V4)
# Timestamp turn into datetime
the ctime = the time.time ()
Print (the ctime)
V5 = datetime.fromtimestamp (the ctime)
Print (V5)