List of usage examples for java.util Date Date
public Date()
From source file:Main.java
public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat simpDate;//from w w w .ja v a 2 s.c o m simpDate = new SimpleDateFormat("hh:mm:ss a"); System.out.println(simpDate.format(date)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat simpDate;/*from ww w . j av a 2s . c o m*/ simpDate = new SimpleDateFormat("kk:mm:ss"); System.out.println(simpDate.format(date)); }
From source file:Main.java
public static void main(String[] args) { // Date to Instant Instant timestamp = new Date().toInstant(); System.out.println(timestamp); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); System.out.println(localDateTime); }
From source file:MainClass.java
public static void main(String[] args) { Date today = new Date(); DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US); String formatted = fmt.format(today); System.out.println(formatted); }
From source file:MainClass.java
public static void main(String args[]) { Date currentDate = new Date(); long msec = currentDate.getTime(); long days = msec / (24 * 60 * 60 * 1000); System.out.println(days);/*from w w w .j a v a 2s. c o m*/ }
From source file:Main.java
public static void main(String[] args) { System.out.println(getTheBeginingOfDate(new Date())); }
From source file:MainClass.java
public static void main(String[] args) throws ParseException { new java.sql.Time(new Date().getTime()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("Today is {0,date,full} and UTC of 0 is {1,date,full}", params); System.out.println(msg);/* www .j a v a 2 s .c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("{0,time,short} and UTC of 0 is {1,time,short}", params); System.out.println(msg);/*from www .ja v a 2 s.c o m*/ }