List of usage examples for java.util Date Date
public Date()
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy"); String strDate = sdf.format(date); System.out.println("formatted date in mm/dd/yy : " + strDate); sdf = new SimpleDateFormat("dd/MM/yyyy"); strDate = sdf.format(date);//from ww w. j a v a 2 s . co m System.out.println("formatted date in dd/MM/yyyy : " + strDate); }
From source file:Main.java
public static void main(String[] args) { Date now = new Date(); System.out.println("toString(): " + now); // dow mon dd hh:mm:ss zzz yyyy SimpleDateFormat dateFormatter = new SimpleDateFormat("E, y-M-d 'at' h:m:s a z"); System.out.println("Format 1: " + dateFormatter.format(now)); dateFormatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); System.out.println("Format 2: " + dateFormatter.format(now)); dateFormatter = new SimpleDateFormat("EEEE, MMMM d, yyyy"); System.out.println("Format 3: " + dateFormatter.format(now)); }
From source file:Main.java
public static void main(String[] args) { System.out.println(roundTo30Minutes(new Date())); }
From source file:Main.java
public static void main(String[] args) { Date today = new Date(); String timestamp = DateFormatUtils.ISO_DATETIME_FORMAT.format(today); System.out.println("timestamp = " + timestamp); }
From source file:Main.java
public static void main(String[] argv) { System.out.println(firstTimeOfMonth(new Date())); }
From source file:Main.java
public static void main(String[] args) { System.out.println(convertToSqlTimestamp(new Date())); }
From source file:Main.java
public static void main(String[] argv) { System.out.println(lastTimeOfMonth(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat simpDate;/*from w ww .ja v a 2 s. c o m*/ simpDate = new SimpleDateFormat("EEEE MMMMM dd yyyy kk:mm:ss"); System.out.println(simpDate.format(date)); }
From source file:Main.java
public static void main(String[] args) { System.out.println(getTheEndOfDate(new Date())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat simpDate;/*from www.ja va 2 s. c o m*/ simpDate = new SimpleDateFormat("dd MMM yyyy hh:mm:ss a"); System.out.println(simpDate.format(date)); }