http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html
Date today; String output; SimpleDateFormat formatter; formatter = new SimpleDateFormat(pattern, currentLocale); today = new Date(); output = formatter.format(today); System.out.println(pattern + " " + output);
The following table shows the output generated by the previous code example when the U.S. Locale
is specified:
Pattern | Output |
---|---|
dd.MM.yy | 30.06.09 |
yyyy.MM.dd G 'at' hh:mm:ss z | 2009.06.30 AD at 08:29:36 PDT |
EEE, MMM d, ''yy | Tue, Jun 30, '09 |
h:mm a | 8:29 PM |
H:mm | 8:29 |
H:mm:ss:SSS | 8:28:36:249 |
K:mm a,z | 8:29 AM,PDT |
yyyy.MMMMM.dd GGG hh:mm aaa | 2009.June.30 AD 08:29 AM |