List of usage examples for java.util Date Date
public Date()
From source file:MainClass.java
public static void main(String[] args) { Date now = new Date(); System.out.printf("one-or-two digit hour on a 12-hour: %tl/%Tl\n", now, now); }
From source file:MainClass.java
public static void main(String[] args) { Date now = new Date(); System.out.printf("seconds since the epoch: %ts/%Ts\n", now, now); }
From source file:MainClass.java
public static void main(String[] args) { Date now = new Date(); System.out.printf("milliseconds since the epoch: %TQ\n", now); }
From source file:MainClass.java
public static void main(String[] args) { Date now = new Date(); System.out.printf("Locale-specific morning/afternoon indicator: %tp/%Tp\n", now, now); }
From source file:MainClass.java
public static void main(String[] args) { Date now = new Date(); System.out.printf("RFC 822 numeric time zone indicator: %tz/%Tz\n", now, now); }
From source file:Main.java
public static void main(String args[]) { Date date = new Date(); System.out.println(date);/*from w w w. j a v a 2 s. c o m*/ long msec = date.getTime(); System.out.println("Milliseconds since Jan. 1, 1970 GMT=" + msec); }
From source file:Main.java
public static void main(String[] args) { Date d1 = new Date(); Date d2 = new Date(); System.out.println("First Date : " + d1); System.out.println("Second Date : " + d2); System.out.println("Is second date after first ? : " + d2.after(d1)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); long diff = date.getTime(); System.out.println(diff);/* w w w . ja va 2s. c o m*/ }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); Date date2 = new Date(); boolean before = date2.before(date); System.out.println(before);// w ww. j av a 2s .c o m before = date.before(date2); System.out.println(before); }
From source file:Main.java
public static void main(String[] args) { Date currentDate = new Date(); System.out.println("Current date: " + currentDate); long millis = currentDate.getTime(); System.out.println("Current datetime in millis: " + millis); }