1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMMdd", Locale.US);
System.out.println( sdf.format(new Date()) ); // 2009Oct12
// On récupère les symboles :
DateFormatSymbols symbols = sdf.getDateFormatSymbols();
// On récupère les libellés des mois au format court :
String[] shortMonths = symbols.getShortMonths();
// On met tout en minuscule :
for (int i=0; i<shortMonths.length; i++) {
shortMonths[i] = shortMonths[i].toLowerCase();
}
// On change les libellés court :
symbols.setShortMonths(shortMonths);
// Et on change les symbols du SimpleDateFormat :
sdf.setDateFormatSymbols(symbols);
System.out.println( sdf.format(new Date()) ); // 2009oct12 |
Partager