-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path63_Time Module.py
More file actions
31 lines (22 loc) · 1.02 KB
/
63_Time Module.py
File metadata and controls
31 lines (22 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import time
# print(time.ctime(0)) # convert a time expressed in seconds since epoch to a readable string
# epoch = when your computer thinks time began (reference point)
#print(time.ctime(1000000))
#print(time.time()) # return current seconds since epoch
#print(time.ctime(time.time()))
#time_object = time.localtime() # local time
# time_object = time.gmtime() # UTC time
# print(time_object)
# local_time = time.strftime("%B %d %Y %H:%M:%S", time_object)
#print(local_time)
# time_string = "20 April, 2020"
# time_object = time.strptime(time_string,"%d %B, %Y")
# print(time_object)
# (year, month, day, hours, minutes, secs, # day of the week, # day of the year, dst(daylight savings time))
time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0)
time_string = time.asctime(time_tuple)
print(time_string)
# (year, month, day, hours, minutes, secs, # day of the week, # day of the year, dst(daylight savings time))
time_tuple = (2020, 4, 20, 4, 20, 0, 0, 0, 0)
time_string = time.mktime(time_tuple)
print(time_string)