Categories
Python Answers

How to get the current time with Python?

Spread the love

Sometimes, we want to get the current time with Python.

In this article, we’ll look at how to get the current time with Python.

How to get the current time with Python?

To get the current time with Python, we can use datetime.datetime.now().time().

For instance, we write

t = datetime.datetime.now().time()

to get the current datetime with datetime.datetime.now().

And then we get the time of the current datetime with time.

Conclusion

To get the current time with Python, we can use datetime.datetime.now().time().

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *