I want to know the current time in Python

Asked 2 years ago, Updated 2 years ago, 113 views

Is there a module or function that tells you the current time?

python datetime time

2022-09-21 17:14

1 Answers

Write as follows

import datetime

print datetime.datetime.now()
print datetime.datetime.time(datetime.datetime.now())
print datetime.datetime.now().time()

YYYY-MM-DD HH:MM:SS.mmmmmm HH:MM:SS.mmmmmm HH:MM:SS.mmmmmm.

For the datetime module, see datetime


2022-09-21 17:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.