Javatpoint Logo

91-9990449935

 0120-4256464

Java Date

The java.util, java.sql and java.text packages contains classes for representing date and time. Following classes are important for dealing with date in java.

Get Current Date

There are 4 ways to print current date in java.

1st way:

Output:

Wed Mar 27 08:22:02 IST 2015

2nd way:

Output:

Wed Mar 27 08:22:02 IST 2015

3rd way:

Output:

2015-03-27

4th way:

Output:

Wed Mar 27 08:22:02 IST 2015