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

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

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.