datetime

Stdlib — Date/TimePython 2.0+Beginner

Classes for dates and times: date, time, datetime, timedelta

Quick Info

Documentation
Official Docs
Python Version
2.0+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
from datetime import datetime, timedelta

now = datetime.now()
print(f"Now: {now}")
print(f"Date: {now.date()}")
print(f"Tomorrow: {now + timedelta(days=1)}")

The datetime module is part of Python's standard library. Classes for dates and times: date, time, datetime, timedelta.

Try in Playground

Tags

stdlibdatetimetimedatecalendar

Related Items