1
我只需要以下列格式在控制檯上打印日期:Day.Month.Year
。例如:03.10.09
未被棄用的Java日期函數
代碼:
GregorianCalendar c = new GregorianCalendar();
Date s = c.getTime();
System.out.println(s);
控制檯打印:
Sat Oct 03 13:33:36 CEST 2009
我可以用一個case語句做到這一點,但我相信有一些東西更優雅,我只是沒找不到。
哎呀.. 現在我發現http://www.torsten-horn.de/techdocs/java-date.htm這個職位。 SimpleDateFormat正是我需要的,thx的幫助。 – dayscott 2009-10-03 11:49:35