Java Date.getTime()
Syntax
Date.getTime() has the following syntax.
public long getTime()
Example
In the following code shows how to use Date.getTime() method.
/*from w w w.j a v a 2s . co m*/
import java.util.Date;
public class Main {
public static void main(String[] args) {
Date date = new Date();
long diff = date.getTime();
System.out.println(diff);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »