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[] argv) throws Exception { Format formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z"); String s = formatter.format(new Date()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("dd"); String s = formatter.format(new Date()); System.out.println(s);//w ww . ja va 2s . c om }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("MMM"); String s = formatter.format(new Date()); System.out.println(s);// ww w.j a v a 2 s .c o m }
From source file:MainClass.java
public static void main(String[] args) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); String date = "2003/01/10"; java.util.Date utilDate = null; try {//from w w w .j av a 2 s. c o m utilDate = formatter.parse(date); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("date:" + date); System.out.println("utilDate:" + utilDate); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("d"); String s = formatter.format(new Date()); System.out.println(s);/*w w w . j a v a 2s . c om*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("MMMM"); String s = formatter.format(new Date()); System.out.println(s);/*from www . j av a2 s .co m*/ }
From source file:Main.java
public static void main(String[] args) throws Exception { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy"); String trouble = "18?11?2003"; String goodOne = "18-11-2003"; Date date = simpleDateFormat.parse(goodOne); System.out.println(date);// w w w . j a va 2 s. c om date = simpleDateFormat.parse(trouble); System.out.println(date); System.out.println(String.format("\\u%04x", (int) trouble.charAt(2))); System.out.println(String.format("\\u%04x", (int) goodOne.charAt(2))); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("z"); String s = formatter.format(new Date()); System.out.println(s);/* ww w .j a v a 2 s . co m*/ }
From source file:Main.java
public static void main(String[] args) { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS"); long now = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(now);//from ww w . j av a 2 s .c o m System.out.println(now + " = " + formatter.format(calendar.getTime())); }
From source file:Main.java
public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat("zzzz"); String s = formatter.format(new Date()); System.out.println(s);/* w ww . j a va 2 s. c o m*/ }