Get time java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Get time java

How can I get current date and time in java?

13th Jun 2019, 8:16 PM
<Coding> </Tutorials>
<Coding> </Tutorials> - avatar
3 Answers
+ 5
You should import java.util.Date
13th Jun 2019, 8:21 PM
Airree
Airree - avatar
+ 3
System.out.print(new java.util.Date());
13th Jun 2019, 10:43 PM
D_Stark
D_Stark - avatar
+ 2
You can do it with this: Date date = new Date(); Or this: System.currentTimeMillis(); Just how Airree mentioned; you have to import the Date library
13th Jun 2019, 8:53 PM
TheLastCookie
TheLastCookie - avatar