Skip to content

Chapter 27: Working with Dates and Time

Python's datetime module allows you to work with dates and times.

Example

Python
1
2
3
4
from datetime import datetime

now = datetime.now()
print(now)  # Outputs the current date and time