- localtime() is a python function which return the time of local machine.
- It is defined inside the 'time' library
-It return localtime in list format that contain day month year, current time etc.
print("Current year is -",t)
print("Month is -",t)
print("Date is -",t)
print("Time is -",t,":",t,":",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)
-In this program, firstly we import the time library by import time then using t=time.localtime() we get all information of local time in the list, then we shows the list items one by one.