Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

How to Get the Current Time in Python (Summary)

In this video course, you’ve generated a datetime object and have seen how to pick out different attributes of the object. You’ve also examined a few ways to output the datetime object in different formats.

You’ve also acquainted yourself with Unix time and ISO timestamps and explored how you can represent your timestamp unambiguously. For this, you’ve dipped your toes into the complex world of time zones and made your datetime object time zone aware.

To dive deeper into the datetime module, check out Using Python datetime to Work With Dates and Times. You can also explore the time module with A Beginner’s Guide to the Python time Module and Mastering Python’s Built-in time Module.

If you’re looking to time how long things take, then check out the tutorial Python Timer Functions: Three Ways to Monitor Your Code.

Download

Sample Code (.zip)

3.9 KB
Download

Course Slides (.pdf)

6.6 MB

Become a Member to join the conversation.