List of usage examples for java.text DateFormat FULL
int FULL
To view the source code for java.text DateFormat FULL.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); String strDate = DateFormat.getDateInstance(DateFormat.FULL).format(date); System.out.println(strDate);/* www. j a v a 2 s . c om*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { String s = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA).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[] a) { Date aDate;//from w w w .ja va2 s. co m DateFormat fmt = DateFormat.getDateInstance(DateFormat.FULL, Locale.US); try { aDate = fmt.parse("Saturday, July 4, 1998 "); System.out.println("The Date string is: " + fmt.format(aDate)); } catch (java.text.ParseException e) { System.out.println(e); } }
From source file:CalendarManipulation.java
public static void main(String s[]) { Calendar cal = Calendar.getInstance(); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM); System.out.println(df.format(cal.getTime())); }
From source file:MainClass.java
public static void main(String[] args) { Date today = new Date(); DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US); String formatted = fmt.format(today); System.out.println(formatted); }
From source file:CalendarManipulation.java
public static void main(String s[]) { Calendar cal = Calendar.getInstance(); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM); System.out.println(df.format(cal.getTime())); cal.add(Calendar.DATE, 8);/*from ww w. j a v a 2 s .c o m*/ System.out.println(df.format(cal.getTime())); }
From source file:CalendarManipulation.java
public static void main(String s[]) { Calendar cal = Calendar.getInstance(); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM); System.out.println(df.format(cal.getTime())); cal.add(Calendar.HOUR, -4);//from ww w . j av a2 s. c o m System.out.println(df.format(cal.getTime())); }
From source file:CalendarManipulation.java
public static void main(String s[]) { Calendar cal = Calendar.getInstance(); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM); System.out.println(df.format(cal.getTime())); cal.add(Calendar.AM_PM, 1);/*from w w w .j av a2s . co m*/ System.out.println(df.format(cal.getTime())); }
From source file:Main.java
public static void main(String[] args) { Date date = new Date(); String strDate = DateFormat.getDateInstance(DateFormat.DEFAULT).format(date); System.out.println(strDate);// w ww. j a v a 2s .co m strDate = DateFormat.getDateInstance(DateFormat.FULL).format(date); System.out.println(strDate); strDate = DateFormat.getDateInstance(DateFormat.LONG).format(date); System.out.println(strDate); strDate = DateFormat.getDateInstance(DateFormat.SHORT).format(date); System.out.println(strDate); }
From source file:MainClass.java
public static void main(String[] args) { DateFormat shortDf = DateFormat.getDateInstance(DateFormat.SHORT); DateFormat mediumDf = DateFormat.getDateInstance(DateFormat.MEDIUM); DateFormat longDf = DateFormat.getDateInstance(DateFormat.LONG); DateFormat fullDf = DateFormat.getDateInstance(DateFormat.FULL); System.out.println(shortDf.format(new Date())); System.out.println(mediumDf.format(new Date())); System.out.println(longDf.format(new Date())); System.out.println(fullDf.format(new Date())); // parsing/*w w w .j av a 2 s .c o m*/ try { Date date = shortDf.parse("Jan 32, 2005"); } catch (ParseException e) { } }