List of usage examples for java.util Date Date
public Date()
From source file:Main.java
public static void main(String[] args) { Date d = new Date(); SimpleDateFormat sd = new SimpleDateFormat("MMMM dd, YYYY"); SimpleDateFormat sd1 = new SimpleDateFormat("HH:mm"); String s = sd.format(d);//from w ww .j ava2 s . c o m String s1 = sd1.format(d); System.out.println(s + " " + s1); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("ss"); System.out.println("seconds in ss format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("m"); System.out.println("minutes in m format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("mm"); System.out.println("minutes in mm format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yy"); System.out.println("Current year in yy format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); System.out.println("Current year in yyyy format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); String strDateFormat = "HH:mm:ss a"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); System.out.println(sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MMMM"); System.out.println("Current Month in MMMM format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] argv) { System.out.println(getDay(new Date())); }
From source file:PrintfExamples.java
public static void main(String[] args) { System.out.printf("The DATE is %tC\n", new Date()); System.out.printf("The DATE is %tz\n", new Date()); }