- localtime() is a python function which return the time of local machine.
- It is defined inside the 'time' library
Syntax-
time.localtime()
-It return localtime in list format that contain day month year, current time etc.
program-
import time
t=time.localtime()
print("Current year is -",t[0])
print("Month is -",t[1])
print("Date is -",t[2])
print("Time is -",t[3],":",t[4],":",t[5])
print(t)
Current year is - 2019
Month is - 5
Date is - 3
Time is - 6 : 44 : 11
time.struct_time(tm_year=2019, tm_mon=5, tm_mday=3, tm_hour=6, tm_min=44, tm_sec=11, tm_wday=4, tm_yday=123, tm_isdst=0)