Published Jun 7, 2022
Contribute to Docs
datetime.time() method returns a time in seconds that has passed since the epoch set on the computer.
datetime.time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
The epoch is usually set as
January 1, 1970, 00:00:00 (UTC) on most operating systems, excluding any leap seconds.
The time can be retrieved and stored in a variable as shown below:
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
Computer ScienceLooking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
Includes 6 Courses
With Professional Certification