Python datetime Module
Multiple Choice Easy
Question
How do you get the current date and time in Python?
Hint
You need the datetime class from the datetime module.
Explanation
After import datetime, you call datetime.datetime.now() — the first datetime is the module, the second is the class. Alternatively, from datetime import datetime lets you call datetime.now().
Related Resources
Related Lessons
- Datetime
Current date and time.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.