Java Calendar.getTime()
Syntax
Calendar.getTime() has the following syntax.
public final Date getTime()
Example
In the following code shows how to use Calendar.getTime() method.
//from w ww . ja v a 2s . c o m
import java.util.Calendar;
public class Main {
public static void main(String[] args) throws InterruptedException {
Calendar cal = Calendar.getInstance();
// print current time
System.out.println(" Current time is : " + cal.getTime());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »