+2 votes
2 views
in Python by (10.2k points)
I want to get current time in Python, what are the method/module to do so?

2 Answers

0 votes
by (2k points)
edited by

It's a very simple and useful task to perform, just use time.strftime().

>>> from time import gmtime, strftime
>>> strftime("%Y-%m-%d %H:%M:%S", gmtime())
'2019-24-05 03:11:05'

Happy Learning, Cheers. 

0 votes
by (107k points)

You can use below-mentioned code for that:-

>>> import datetime

>>> datetime.datetime.now()

>>> print(datetime.datetime.now())

You can use the following video tutorials to clear all your doubts:-

Related questions

0 votes
1 answer
0 votes
1 answer
+2 votes
2 answers
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...