List of usage examples for java.text SimpleDateFormat format
public final String format(Date 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:MainClass.java
public static void main(String args[]) { Date date = new Date(); SimpleDateFormat sdf; sdf = new SimpleDateFormat("hh:mm:ss"); System.out.println(sdf.format(date)); sdf = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz"); System.out.println(sdf.format(date)); sdf = new SimpleDateFormat("E MMM dd yyyy"); 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("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("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("MM"); System.out.println("Current Month in MM format : " + sdf.format(date)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat(); formatter.applyPattern("MMM"); String s = formatter.format(new Date()); System.out.println(s);//from w ww.jav a2 s.c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { String laDate = "2014-06-15"; String dateString = laDate.substring(8, 10) + "/" + laDate.substring(5, 7) + "/" + laDate.substring(0, 4); Date date = new SimpleDateFormat("dd/MM/yyyy").parse(dateString); String dateFormat = "dd-MMM-yyyy"; SimpleDateFormat sdf = new SimpleDateFormat(dateFormat, new Locale("en_US")); String tDate = sdf.format(date); System.out.println(tDate);//from ww w .ja v a2 s.co m }
From source file:Main.java
public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat simpDate; simpDate = new SimpleDateFormat("kk:mm:ss"); System.out.println(simpDate.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(); String strDateFormat = "h"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); System.out.println("hour in h format : " + sdf.format(date)); }