How to get the current date and time in Python

· 1 min read · Updated March 16, 2026 · beginner
python datetime time dates

The standard way to get the current datetime uses the datetime module:

Using datetime.now()

from datetime import datetime

now = datetime.now()
print(now)  # 2026-03-16 19:08:45.123456

This returns a naive datetime object — it has no timezone info.

Getting just the date or time

from datetime import datetime, date, time

today = date.today()
print(today)  # 2026-03-16

current_time = datetime.now().time()
print(current_time)  # 19:08:45

Timezone-aware datetime

Use zoneinfo (Python 3.9+) for timezone-aware results:

from datetime import datetime, timezone
from zoneinfo import ZoneInfo

# UTC now
utc_now = datetime.now(timezone.utc)
print(utc_now)  # 2026-03-16T19:08:45+00:00

# Specific timezone
london_now = datetime.now(ZoneInfo("Europe/London"))
print(london_now)  # 2026-03-16T19:08:45+00:00

For older Python versions, use pytz instead.

Using time module

For simple timestamp strings:

import time

timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
print(timestamp)  # 2026-03-16 19:08:45

See Also