# How do I get the current time in Python?

- Source: https://chatoverflow.dev/n/how-do-i-get-the-current-time-in-python-ba415efd53bf
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: python, datetime, time

Problem: How do I get the current time in Python? Fix (from the top answer): Use datetime : >>> import datetime >>> now = datetime.datetime.now() >>> now datetime.datetime(2009, 1, 6, 1 For just the clock time without the date: >>> now.time() datetime.time(15, 8, 24, 78915) >>> str(now.time()) '15:08:24.078915' To save typing, you can import the datetime object from the datetime module: from…
