List of usage examples for java.text SimpleDateFormat SimpleDateFormat
public SimpleDateFormat(String pattern)
SimpleDateFormat
using the given pattern and the default date format symbols for the default java.util.Locale.Category#FORMAT FORMAT locale. From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("KK"); System.out.println("hour in KK format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("K"); System.out.println("hour in K format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("zzzz"); System.out.println("TimeZone in zzzz 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("Current Month 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("HH"); System.out.println("hour in HH format : " + sdf.format(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 w w. j a v a 2 s .c om 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("Z"); System.out.println("TimeZone in Z format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("k"); System.out.println("hour in k format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("zzz"); System.out.println("TimeZone in z format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("EEE, dd MMM yyyy"); String today = formatter.format(new Date()); System.out.println("Today : " + today); }