How to get the current time in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to get the current time in java?

I want to get the current time in java to make something which when run will show different output depending on java. For that i want to know how to get current time in java. Thanks!!

5th Jul 2017, 8:09 AM
Nitin Kumar
Nitin Kumar - avatar
3 Answers
5th Jul 2017, 8:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
thanks @hasty rei What If i need only time and date and also of my country. I think its showing time of greenland.
5th Jul 2017, 8:30 AM
Nitin Kumar
Nitin Kumar - avatar
+ 3
got it on stackoverflow. thanks. calender.getInstance(); and then cal.getTime() 😊 Thanks again
5th Jul 2017, 9:07 AM
Nitin Kumar
Nitin Kumar - avatar