Explore Courses Blog Tutorials Interview Questions
+2 votes
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 (106k points)

You can use below-mentioned code for that:-

>>> import datetime


>>> print(

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

Related questions

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

28.4k questions

29.7k answers


94.1k users

Browse Categories