|
|
|
|
Configuration: Windows Vista Firefox 2.0.0.11
Salut,
Essaie ceci:
String str = "09/Mar/2008:04:03:04";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss", java.util.Locale.US);
sdf.setLenient(false);
java.util.Date dte = sdf.parse(str);
System.out.println(dte);
Pour une raison inconnue, si je passe la Locale à FRENCH, ça marche moins bien... Quelqu'un sait ce que l'on doit mettre à la place de "MMM" ci-dessus pour avoir un parsage des mois (format court) en fr? Est-ce que "Mar" est correct pour le format court du mois de mars? ++
|
oui, merci |
Gros oubli :
Il manque tout simplement cette 2eme source import java.io.*; import java.util.*; // Date import java.text.*; // SimpleDateFormat public class FormatsSimpleDate { public static String init(String retour) { String form = retour; Locale local = Locale.FRENCH; // Date SimpleDateFormat formatd01a = new SimpleDateFormat("G"); SimpleDateFormat formatd01b = new SimpleDateFormat("GG"); SimpleDateFormat formatd01c = new SimpleDateFormat("GGG"); SimpleDateFormat formatd01d = new SimpleDateFormat("GGGG"); SimpleDateFormat formatd02a = new SimpleDateFormat("y"); SimpleDateFormat formatd02b = new SimpleDateFormat("yy"); SimpleDateFormat formatd02c = new SimpleDateFormat("yyy"); SimpleDateFormat formatd02d = new SimpleDateFormat("yyyy"); SimpleDateFormat formatd03a = new SimpleDateFormat("M", local); // local inutile car num. SimpleDateFormat formatd03b = new SimpleDateFormat("MM", local); // " " " SimpleDateFormat formatd03c = new SimpleDateFormat("MMM", local); SimpleDateFormat formatd03d = new SimpleDateFormat("MMMM", local); SimpleDateFormat formatd04a = new SimpleDateFormat("w"); SimpleDateFormat formatd04b = new SimpleDateFormat("ww"); SimpleDateFormat formatd04c = new SimpleDateFormat("www"); SimpleDateFormat formatd04d = new SimpleDateFormat("wwww"); SimpleDateFormat formatd05a = new SimpleDateFormat("W"); SimpleDateFormat formatd05b = new SimpleDateFormat("WW"); SimpleDateFormat formatd05c = new SimpleDateFormat("WWW"); SimpleDateFormat formatd05d = new SimpleDateFormat("WWWW"); SimpleDateFormat formatd06a = new SimpleDateFormat("D"); SimpleDateFormat formatd06b = new SimpleDateFormat("DD"); SimpleDateFormat formatd06c = new SimpleDateFormat("DDD"); SimpleDateFormat formatd06d = new SimpleDateFormat("DDDD"); SimpleDateFormat formatd07a = new SimpleDateFormat("d"); SimpleDateFormat formatd07b = new SimpleDateFormat("dd"); SimpleDateFormat formatd07c = new SimpleDateFormat("ddd"); SimpleDateFormat formatd07d = new SimpleDateFormat("dddd"); SimpleDateFormat formatd08a = new SimpleDateFormat("F"); SimpleDateFormat formatd08b = new SimpleDateFormat("FF"); SimpleDateFormat formatd08c = new SimpleDateFormat("FFF"); SimpleDateFormat formatd08d = new SimpleDateFormat("FFFF"); SimpleDateFormat formatd09a = new SimpleDateFormat("E", local); SimpleDateFormat formatd09b = new SimpleDateFormat("EE", local); SimpleDateFormat formatd09c = new SimpleDateFormat("EEE", local); SimpleDateFormat formatd09d = new SimpleDateFormat("EEEE", local); // Heure SimpleDateFormat formath01a = new SimpleDateFormat("a", local); SimpleDateFormat formath01b = new SimpleDateFormat("aa", local); SimpleDateFormat formath01c = new SimpleDateFormat("aaa", local); SimpleDateFormat formath01d = new SimpleDateFormat("aaaa", local); SimpleDateFormat formath01e = new SimpleDateFormat("a"); SimpleDateFormat formath01f = new SimpleDateFormat("aa"); SimpleDateFormat formath01g = new SimpleDateFormat("aaa"); SimpleDateFormat formath01h = new SimpleDateFormat("aaaa"); SimpleDateFormat formath02a = new SimpleDateFormat("H"); SimpleDateFormat formath02b = new SimpleDateFormat("HH"); SimpleDateFormat formath02c = new SimpleDateFormat("HHH"); SimpleDateFormat formath02d = new SimpleDateFormat("HHHH"); SimpleDateFormat formath03a = new SimpleDateFormat("k"); SimpleDateFormat formath03b = new SimpleDateFormat("kk"); SimpleDateFormat formath03c = new SimpleDateFormat("kkk"); SimpleDateFormat formath03d = new SimpleDateFormat("kkkk"); SimpleDateFormat formath04a = new SimpleDateFormat("K"); SimpleDateFormat formath04b = new SimpleDateFormat("KK"); SimpleDateFormat formath04c = new SimpleDateFormat("KKK"); SimpleDateFormat formath04d = new SimpleDateFormat("KKKK"); SimpleDateFormat formath05a = new SimpleDateFormat("h"); SimpleDateFormat formath05b = new SimpleDateFormat("hh"); SimpleDateFormat formath05c = new SimpleDateFormat("hhh"); SimpleDateFormat formath05d = new SimpleDateFormat("hh"); SimpleDateFormat formath06a = new SimpleDateFormat("m"); SimpleDateFormat formath06b = new SimpleDateFormat("mm"); SimpleDateFormat formath06c = new SimpleDateFormat("mmm"); SimpleDateFormat formath06d = new SimpleDateFormat("mmmm"); SimpleDateFormat formath07a = new SimpleDateFormat("s"); SimpleDateFormat formath07b = new SimpleDateFormat("ss"); SimpleDateFormat formath07c = new SimpleDateFormat("sss"); SimpleDateFormat formath07d = new SimpleDateFormat("ssss"); SimpleDateFormat formath08a = new SimpleDateFormat("S"); SimpleDateFormat formath08b = new SimpleDateFormat("SS"); SimpleDateFormat formath08c = new SimpleDateFormat("SSS"); SimpleDateFormat formath08d = new SimpleDateFormat("SSSS"); SimpleDateFormat formath09a = new SimpleDateFormat("z"); SimpleDateFormat formath09b = new SimpleDateFormat("zz"); SimpleDateFormat formath09c = new SimpleDateFormat("zzz"); SimpleDateFormat formath09d = new SimpleDateFormat("zzzz"); SimpleDateFormat formath10a = new SimpleDateFormat("Z"); SimpleDateFormat formath10b = new SimpleDateFormat("ZZ"); SimpleDateFormat formath10c = new SimpleDateFormat("ZZZ"); SimpleDateFormat formath10d = new SimpleDateFormat("ZZZZ"); SimpleDateFormat formath11a = new SimpleDateFormat("z", local); SimpleDateFormat formath11b = new SimpleDateFormat("zz", local); SimpleDateFormat formath11c = new SimpleDateFormat("zzz", local); SimpleDateFormat formath11d = new SimpleDateFormat("zzzz", local); SimpleDateFormat formath12a = new SimpleDateFormat("Z", local); SimpleDateFormat formath12b = new SimpleDateFormat("ZZ", local); SimpleDateFormat formath12c = new SimpleDateFormat("ZZZ", local); SimpleDateFormat formath12d = new SimpleDateFormat("ZZZZ", local); // Date et heure SimpleDateFormat formatx01a = new SimpleDateFormat("EEEE d MMMM yyyy G HH:mm:ss zzzz", local); SimpleDateFormat formatx01b = new SimpleDateFormat("EEEE d MMMM yyyy G kk:mm:ss zzzz"); SimpleDateFormat formatx01c = new SimpleDateFormat("EEEEdMMMM yyyy G HH:mm:ss zzdz", local); if (form.equals("liste")) retour = ( " Letter Date or Time Component Presentation Examples\n\n" + " G Era designator Text AD\n\n" + " y Year Year 007 ; 07\n\n" + " M Month in year Month juillet ; juil. ; 07\n\n" + " w Week in year Number 30\n\n" + " W Week in month Number 5\n\n" + " D Day in year Number 207\n\n" + " d Day in momth Number 26\n\n" + " F Day of week in month Number 4\n\n" + " E Day in week Text jeudi ; jeu.\n\n" + " a Am/Pm marker Text AM\n\n" + " H Hour in day (0-23) Number 0\n\n" + " k Hour in day (1-24) Number 24\n\n" + " K Hour in am/pm (0-11) Number 0\n\n" + " h Hour in am/pm (1-12) Number 12\n\n" + " m Minute in hour Number 30\n\n" + " s Second in minute Number 55\n\n" + " S Millisecond Number 976\n\n" + " z Time zone General time zone Heure de Greenwich\n\n" + " Z Time zone RFC 822 time zone -0800\n\n" + "\n\nRetours" ); else System.out.println(form); if (form.equals("\"G\"")) retour = ("SimpleDateFormat formatd01a = new SimpleDateFormat(\"G\")" + " retourne :\n" + formatd01a.format(new Date())); // Ere AD else if (form.equals("\"GG\"")) retour = ("SimpleDateFormat formatd01b = new SimpleDateFormat(\"GG\")" + " retourne :\n" + formatd01b.format(new Date())); // Ere AD else if (form.equals("\"GGG\"")) retour = ("SimpleDateFormat formatd01c = new SimpleDateFormat(\"GGG\")" + " retourne :\n" + formatd01c.format(new Date())); // Ere AD else if (form.equals("\"GGGG\"")) retour = ("SimpleDateFormat formatd01d = new SimpleDateFormat(\"GGGG\")" + " retourne :\n" + formatd01d.format(new Date())); // Ere AD if (form.equals("\"y\"")) retour = ("SimpleDateFormat formatd02a = new SimpleDateFormat(\"y\")" + " retourne :\n" + formatd02a.format(new Date())); // annee aa else if (form.equals("\"yy\"")) retour = ("SimpleDateFormat formatd02b = new SimpleDateFormat(\"yy\")" + " retourne :\n" + formatd02b.format(new Date())); // annee aa else if (form.equals("\"yyy\"")) retour = ("SimpleDateFormat formatd02c = new SimpleDateFormat(\"yyy\")" + " retourne :\n" + formatd02c.format(new Date())); // annee aa else if (form.equals("\"yyyy\"")) retour = ("SimpleDateFormat formatd02d = new SimpleDateFormat(\"yyyy\")" + " retourne :\n" + formatd02d.format(new Date())); // annee aaaa if (form.equals("\"M\", local")) retour = ("SimpleDateFormat formatd03a = new SimpleDateFormat(\"M\", local)" + " retourne :\n" + formatd03a.format(new Date())); // ... 7, ... 9, 10 ... else if (form.equals("\"MM\", local")) retour = ("SimpleDateFormat formatd03b = new SimpleDateFormat(\"MM\", local)" + " retourne :\n" + formatd03b.format(new Date())); // ... 07, ... 09, 10 ... else if (form.equals("\"MMM\", local")) retour = ("SimpleDateFormat formatd03c = new SimpleDateFormat(\"MMM\", local)" + " retourne :\n" + formatd03c.format(new Date())); // juil. else if (form.equals("\"MMMM\", local")) retour = ("SimpleDateFormat formatd03d = new SimpleDateFormat(\"MMMM\", local)" + " retourne :\n" + formatd03d.format(new Date())); // juillet if (form.equals("\"w\"")) retour = ("SimpleDateFormat formatd04a = new SimpleDateFormat(\"w\")" + " retourne :\n" + formatd04a.format(new Date())); // num. semaine annee else if (form.equals("\"ww\"")) retour = ("SimpleDateFormat formatd04b = new SimpleDateFormat(\"ww\")" + " retourne :\n" + formatd04b.format(new Date())); // num. semaine annee else if (form.equals("\"www\"")) retour = ("SimpleDateFormat formatd04c = new SimpleDateFormat(\"www\")" + " retourne :\n" + formatd04c.format(new Date())); // num. semaine annee else if (form.equals("\"wwww\"")) retour = ("SimpleDateFormat formatd04d = new SimpleDateFormat(\"wwww\")" + " retourne :\n" + formatd04d.format(new Date())); // num. semaine annee if (form.equals("\"W\"")) retour = ("SimpleDateFormat formatd05a = new SimpleDateFormat(\"W\")" + " retourne :\n" + formatd05a.format(new Date())); // num. semaine mois else if (form.equals("\"WW\"")) retour = ("SimpleDateFormat formatd05b = new SimpleDateFormat(\"WW\")" + " retourne :\n" + formatd05b.format(new Date())); // num. semaine mois else if (form.equals("\"WWW\"")) retour = ("SimpleDateFormat formatd05c = new SimpleDateFormat(\"WWW\")" + " retourne :\n" + formatd05c.format(new Date())); // num. semaine mois else if (form.equals("\"WWWW\"")) retour = ("SimpleDateFormat formatd05d = new SimpleDateFormat(\"WWWW\")" + " retourne :\n" + formatd05d.format(new Date())); // num. semaine mois if (form.equals("\"D\"")) retour = ("SimpleDateFormat formatd06a = new SimpleDateFormat(\"D\")" + " retourne :\n" + formatd06a.format(new Date())); // jour de l'annee else if (form.equals("\"DD\"")) retour = ("SimpleDateFormat formatd06b = new SimpleDateFormat(\"DD\")" + " retourne :\n" + formatd06b.format(new Date())); // jour de l'annee else if (form.equals("\"DDD\"")) retour = ("SimpleDateFormat formatd06c = new SimpleDateFormat(\"DDD\")" + " retourne :\n" + formatd06c.format(new Date())); // jour de l'annee else if (form.equals("\"DDDD\"")) retour = ("SimpleDateFormat formatd06d = new SimpleDateFormat(\"DDDD\")" + " retourne :\n" + formatd06d.format(new Date())); // jour de l'annee if (form.equals("\"d\"")) retour = ("SimpleDateFormat formatd07a = new SimpleDateFormat(\"d\")" + " retourne :\n" + formatd07a.format(new Date())); // jour de la semaine else if (form.equals("\"dd\"")) retour = ("SimpleDateFormat formatd07b = new SimpleDateFormat(\"dd\")" + " retourne :\n" + formatd07b.format(new Date())); // jour de la semaine else if (form.equals("\"ddd\"")) retour = ("SimpleDateFormat formatd07c = new SimpleDateFormat(\"ddd\")" + " retourne :\n" + formatd07c.format(new Date())); // jour de la semaine else if (form.equals("\"dddd\"")) retour = ("SimpleDateFormat formatd07d = new SimpleDateFormat(\"dddd\")" + " retourne :\n" + formatd07d.format(new Date())); // jour de la semaine if (form.equals("\"F\"")) retour = ("SimpleDateFormat formatd08a = new SimpleDateFormat(\"F\")" + " retourne :\n" + formatd08a.format(new Date())); // ?? else if (form.equals("\"FF\"")) retour = ("SimpleDateFormat formatd08b = new SimpleDateFormat(\"FF\")" + " retourne :\n" + formatd08b.format(new Date())); // ?? else if (form.equals("\"FFF\"")) retour = ("SimpleDateFormat formatd08c = new SimpleDateFormat(\"FFF\")" + " retourne :\n" + formatd08c.format(new Date())); // ?? else if (form.equals("\"FFFF\"")) retour = ("SimpleDateFormat formatd08d = new SimpleDateFormat(\"FFFF\")" + " retourne :\n" + formatd08d.format(new Date())); // ?? if (form.equals("\"E\", local")) retour = ("SimpleDateFormat formatd09a = new SimpleDateFormat(\"E\", local)" + " retourne :\n" + formatd09a.format(new Date())); // nom jour de la semaine else if (form.equals("\"EE\", local")) retour = ("SimpleDateFormat formatd09b = new SimpleDateFormat(\"EE\", local)" + " retourne :\n" + formatd09b.format(new Date())); // nom jour de la semaine else if (form.equals("\"EEE\", local")) retour = ("SimpleDateFormat formatd09c = new SimpleDateFormat(\"EEE\", local)" + " retourne :\n" + formatd09c.format(new Date())); // nom jour de la semaine else if (form.equals("\"EEEE\", local")) retour = ("SimpleDateFormat formatd09d = new SimpleDateFormat(\"EEEE\", local)" + " retourne :\n" + formatd09d.format(new Date())); // nom jour de la semaine if (form.equals("\"a\", local")) retour = ("SimpleDateFormat formath01a = new SimpleDateFormat(\"a\", local)" + " retourne :\n" + formath01a.format(new Date())); // AM/PM else if (form.equals("\"aa\", local")) retour = ("SimpleDateFormat formath01b = new SimpleDateFormat(\"aa\", local)" + " retourne :\n" + formath01b.format(new Date())); // AM/PM else if (form.equals("\"aaa\", local")) retour = ("SimpleDateFormat formath01c = new SimpleDateFormat(\"aaa\", local)" + " retourne :\n" + formath01c.format(new Date())); // AM/PM else if (form.equals("\"aaaa\", local")) retour = ("SimpleDateFormat formath01d = new SimpleDateFormat(\"aaaa\", local)" + " retourne :\n" + formath01d.format(new Date())); // AM/PM if (form.equals("\"a\"")) retour = ("SimpleDateFormat formath01e = new SimpleDateFormat(\"a\")" + " retourne :\n" + formath01e.format(new Date())); // AM/PM else if (form.equals("\"aa\"")) retour = ("SimpleDateFormat formath01f = new SimpleDateFormat(\"aa\")" + " retourne :\n" + formath01f.format(new Date())); // AM/PM else if (form.equals("\"aaa\"")) retour = ("SimpleDateFormat formath01g = new SimpleDateFormat(\"aaa\")" + " retourne :\n" + formath01g.format(new Date())); // AM/PM else if (form.equals("\"aaaa\"")) retour = ("SimpleDateFormat formath01h = new SimpleDateFormat(\"aaaa\")" + " retourne :\n" + formath01h.format(new Date())); // AM/PM if (form.equals("\"H\"")) retour = ("SimpleDateFormat formath02a = new SimpleDateFormat(\"H\")" + " retourne :\n" + formath02a.format(new Date())); // (0 - 23) else if (form.equals("\"HH\"")) retour = ("SimpleDateFormat formath02b = new SimpleDateFormat(\"HH\")" + " retourne :\n" + formath02b.format(new Date())); // (0 - 23) else if (form.equals("\"HHH\"")) retour = ("SimpleDateFormat formath02c = new SimpleDateFormat(\"HHH\")" + " retourne :\n" + formath02c.format(new Date())); // (0 - 23) else if (form.equals("\"HHHH\"")) retour = ("SimpleDateFormat formath02d = new SimpleDateFormat(\"HHHH\")" + " retourne :\n" + formath02d.format(new Date())); // (0 - 23) if (form.equals("\"k\"")) retour = ("SimpleDateFormat formath03a = new SimpleDateFormat(\"k\")" + " retourne :\n" + formath03a.format(new Date())); // (1 - 24) else if (form.equals("\"kk\"")) retour = ("SimpleDateFormat formath03b = new SimpleDateFormat(\"kk\")" + " retourne :\n" + formath03b.format(new Date())); // (1 - 24) else if (form.equals("\"kkk\"")) retour = ("SimpleDateFormat formath03c = new SimpleDateFormat(\"kkk\")" + " retourne :\n" + formath03c.format(new Date())); // (1 - 24) else if (form.equals("\"kkkk\"")) retour = ("SimpleDateFormat formath03d = new SimpleDateFormat(\"kkkk\")" + " retourne :\n" + formath03d.format(new Date())); // (1 - 24) if (form.equals("\"K\"")) retour = ("SimpleDateFormat formath04a = new SimpleDateFormat(\"K\")" + " retourne :\n" + formath04a.format(new Date())); // (0 - 11) am/pm else if (form.equals("\"KK\"")) retour = ("SimpleDateFormat formath04b = new SimpleDateFormat(\"KK\")" + " retourne :\n" + formath04b.format(new Date())); // (0 - 11) am/pm else if (form.equals("\"KKK\"")) retour = ("SimpleDateFormat formath04c = new SimpleDateFormat(\"KKK\")" + " retourne :\n" + formath04c.format(new Date())); // (0 - 11) am/pm else if (form.equals("\"KKKK\"")) retour = ("SimpleDateFormat formath04d = new SimpleDateFormat(\"KKKK\")" + " retourne :\n" + formath04d.format(new Date())); // (0 - 11) am/pm if (form.equals("\"h\"")) retour = ("SimpleDateFormat formath05a = new SimpleDateFormat(\"h\")" + " retourne :\n" + formath05a.format(new Date())); // (1 - 12) am/pm else if (form.equals("\"hh\"")) retour = ("SimpleDateFormat formath05b = new SimpleDateFormat(\"hh\")" + " retourne :\n" + formath05b.format(new Date())); // (1 - 12) am/pm else if (form.equals("\"hhh\"")) retour = ("SimpleDateFormat formath05c = new SimpleDateFormat(\"hhh\")" + " retourne :\n" + formath05c.format(new Date())); // (1 - 12) am/pm else if (form.equals("\"hhhh\"")) retour = ("SimpleDateFormat formath05d = new SimpleDateFormat(\"hhhh\")" + " retourne :\n" + formath05d.format(new Date())); // (1 - 12) am/pm if (form.equals("\"m\"")) retour = ("SimpleDateFormat formath06a = new SimpleDateFormat(\"m\")" + " retourne :\n" + formath06a.format(new Date())); // Minutes else if (form.equals("\"mm\"")) retour = ("SimpleDateFormat formath06b = new SimpleDateFormat(\"mm\")" + " retourne :\n" + formath06b.format(new Date())); // Minutes else if (form.equals("\"mmm\"")) retour = ("SimpleDateFormat formath06c = new SimpleDateFormat(\"mmm\")" + " retourne :\n" + formath06c.format(new Date())); // Minutes else if (form.equals("\"mmmm\"")) retour = ("SimpleDateFormat formath06d = new SimpleDateFormat(\"mmmm\")" + " retourne :\n" + formath06d.format(new Date())); // Minutes if (form.equals("\"s\"")) retour = ("SimpleDateFormat formath07a = new SimpleDateFormat(\"s\")" + " retourne :\n" + formath07a.format(new Date())); // Secondes else if (form.equals("\"ss\"")) retour = ("SimpleDateFormat formath07b = new SimpleDateFormat(\"ss\")" + " retourne :\n" + formath07b.format(new Date())); // Secondes else if (form.equals("\"sss\"")) retour = ("SimpleDateFormat formath07c = new SimpleDateFormat(\"sss\")" + " retourne :\n" + formath07c.format(new Date())); // Secondes else if (form.equals("\"ssss\"")) retour = ("SimpleDateFormat formath07d = new SimpleDateFormat(\"ssss\")" + " retourne :\n" + formath07d.format(new Date())); // Secondes if (form.equals("\"S\"")) retour = ("SimpleDateFormat formath08a = new SimpleDateFormat(\"S\")" + " retourne :\n" + formath08a.format(new Date())); // Millisecondes else if (form.equals("\"SS\"")) retour = ("SimpleDateFormat formath08b = new SimpleDateFormat(\"SS\")" + " retourne :\n" + formath08b.format(new Date())); // Millisecondes else if (form.equals("\"SSS\"")) retour = ("SimpleDateFormat formath08c = new SimpleDateFormat(\"SSS\")" + " retourne :\n" + formath08c.format(new Date())); // Millisecondes else if (form.equals("\"SSSS\"")) retour = ("SimpleDateFormat formath08d = new SimpleDateFormat(\"SSSS\")" + " retourne :\n" + formath08d.format(new Date())); // Millisecondes if (form.equals("\"z\"")) retour = ("SimpleDateFormat formath09a = new SimpleDateFormat(\"z\")" + " retourne :\n" + formath09a.format(new Date())); // GMT else if (form.equals("\"zz\"")) retour = ("SimpleDateFormat formath09b = new SimpleDateFormat(\"zz\")" + " retourne :\n" + formath09b.format(new Date())); // GMT else if (form.equals("\"zzz\"")) retour = ("SimpleDateFormat formath09c = new SimpleDateFormat(\"zzz\")" + " retourne :\n" + formath09c.format(new Date())); // GMT else if (form.equals("\"zzzz\"")) retour = ("SimpleDateFormat formath09d = new SimpleDateFormat(\"zzzz\")" + " retourne :\n" + formath09d.format(new Date())); // GMT if (form.equals("\"Z\"")) retour = ("SimpleDateFormat formath10a = new SimpleDateFormat(\"Z\")" + " retourne :\n" + formath10a.format(new Date())); // RFC 822 else if (form.equals("\"ZZ\"")) retour = ("SimpleDateFormat formath10b = new SimpleDateFormat(\"ZZ\")" + " retourne :\n" + formath10b.format(new Date())); // RFC 822 else if (form.equals("\"ZZZ\"")) retour = ("SimpleDateFormat formath10c = new SimpleDateFormat(\"ZZZ\", local)" + " retourne :\n" + formath10c.format(new Date())); // RFC 822 else if (form.equals("\"ZZZZ\"")) retour = ("SimpleDateFormat formath10d = new SimpleDateFormat(\"ZZZZ\")" + " retourne :\n" + formath10d.format(new Date())); // RFC 822 if (form.equals("\"z\", local")) retour = ("SimpleDateFormat formath11a = new SimpleDateFormat(\"z\", local)" + " retourne :\n" + formath11a.format(new Date())); // GMT else if (form.equals("\"zz\", local")) retour = ("SimpleDateFormat formath11b = new SimpleDateFormat(\"zz\", local)" + " retourne :\n" + formath11b.format(new Date())); // GMT else if (form.equals("\"zzz\", local")) retour = ("SimpleDateFormat formath11c = new SimpleDateFormat(\"zzz\", local)" + " retourne :\n" + formath11c.format(new Date())); // GMT else if (form.equals("\"zzzz\", local")) retour = ("SimpleDateFormat formath11d = new SimpleDateFormat(\"zzzz\", local)" + " retourne :\n" + formath11d.format(new Date())); // GMT if (form.equals("\"Z\", local")) retour = ("SimpleDateFormat formath12a = new SimpleDateFormat(\"Z\", local)" + " retourne :\n" + formath12a.format(new Date())); // RFC 822 else if (form.equals("\"ZZ\", local")) retour = ("SimpleDateFormat formath12b = new SimpleDateFormat(\"ZZ\", local)" + " retourne :\n" + formath12b.format(new Date())); // RFC 822 else if (form.equals("\"ZZZ\", local")) retour = ("SimpleDateFormat formath12c = new SimpleDateFormat(\"ZZZ\", local)" + " retourne :\n" + formath12c.format(new Date())); // RFC 822 else if (form.equals("\"ZZZZ\", local")) retour = ("SimpleDateFormat formath12d = new SimpleDateFormat(\"ZZZZ\", local)" + " retourne :\n" + formath12d.format(new Date())); // RFC 822 if (form.equals("\"EEEE d MMMM yyyy G HH:mm:ss zzzz\", local")) retour = ("SimpleDateFormat formatx01a = new SimpleDateFormat" + "(\"EEEE d MMMM yyyy G HH:mm:ss zzzz\", local)" + " retourne :\n" + formatx01a.format(new Date())); // date complete + heure if (form.equals("\"EEEE d ' de ' MMMM ' del ' yyyy G ' a las ' kk:mm:ss zzzz\"")) retour = ("SimpleDateFormat formatx01b = new SimpleDateFormat" + "(\"EEEE d ' de ' MMMM ' del ' yyyy G ' a las ' kk:mm:ss zzzz\")" + " retourne :\n" + formatx01b.format(new Date())); if (form.equals("\"EEEEdMMMM yyyy G HH:mm:ss zzdz\", local")) retour = ("SimpleDateFormat formatx01c = new SimpleDateFormat" + "(\"EEEEdMMMM yyyy G HH:mm:ss zzdz\")" + " retourne :\n" + formatx01c.format(new Date())); return retour; } } Dan
|
Salut,
Les formats courts retournes des mois, de janvier a decembre sont les suivants: janv. fevr. * mars avr. mai juin juil. aout * sept. oct. nov. dec. * * avec accent sur le e de fevr. et de dec. ainsi que sur le u deaout et que je ne peux mettre pour le moment - esc alt et la suite- me fait quitter la saisie (normal !)- Il est a noter que Mar est l'abreviation de March. (Locale US) Cordialement. Dan
|
Résultats pour String vers Date en java!!!!
Résultats pour String vers Date en java!!!!
Résultats pour String vers Date en java!!!!
Résultats pour String vers Date en java!!!!
Résultats pour String vers Date en java!!!!