The time Module
We'll cover the following...
The time module provides the Python developer access to various time-related functions. The time module is based around what it known as an epoch, the point when time starts. For Unix systems, the epoch was in 1970. To find out what the epoch is on your system, try running the following:
Press + to interact
import timeprint(time.gmtime(0))#time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
I ran this on Windows 7 and it too seems to think that time began in
- Anyway, in this section, we will be studying the following time-related functions:
- time.ctime
- time.sleep
- time.strftime
- time.time
Let’s get started!
time.ctime
The time.ctime function will convert a time in seconds ...
Access this course and 1400+ top-rated courses and projects.