Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (3.4k points)

What's the best way to get the current date/time in Java?

1 Answer

0 votes
by (46k points)

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-28-06 03:11:05'

Happy Learning, Cheers. 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 29, 2019 in Java by Suresh (3.4k points)
+2 votes
2 answers

Browse Categories