1import time
2import datetime
3
4print(time.time())
5# 1586813438.419919
6
7print(time.ctime())
8# Mon Apr 13 23:30:38 2020
9
10print(datetime.datetime.now())
11# 2021-11-13 23:30:38.419951
12
13print(datetime.date.today())
14# 2021-11-13
1import time
2thistime = time.time()
3# Here's an idea!
4def CountTime():
5 while(True):
6 time.sleep(1)
7 print(thistime)
8CountTime()
1#import time module:
2import time
3#module has various attributes:
4dir(time)
5[..., 'localtime', 'mktime', 'sleep', 'sleep_ms', 'sleep_us', 'ticks_add', 'ticks_cpu', 'ticks_diff', 'ticks_ms', 'ticks_us', 'time']
6
7#default expression is in seconds with zero being start of runtime
8secFromStart = time.time()