Bonjour,
J'ai un problème au niveau d'un calcul de date en fait j'ai le code suivant :
Ca fonctionne très bien sauf quand je rentre une date au mois de décembre par exemple pour le 08/12/2004 si je lui ajoute 12 mois eh bien ma variable nouvelleDateProchainControle est égale à 08.00.2006 et je ne comprend pas. Est-ce-que quelqu'un a une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 String nouvelleDateProchainControle = ""; Integer day = new Integer(jour); Integer month = new Integer(mois); Integer year = new Integer(annee); System.out.println("day : "+day); System.out.println("month : "+month); System.out.println("year : "+year); Calendar newDate = new GregorianCalendar(year.intValue(), month.intValue(), day.intValue()); System.out.println("newDate : "+newDate); System.out.println("periodiciteMois : " + periodiciteMois); newDate.add(Calendar.MONTH,periodiciteMois); nouvelleDateProchainControle = Utilities.makeString(newDate.get(Calendar.DAY_OF_MONTH),2) + "." + Utilities.makeString(newDate.get(Calendar.MONTH),2) + "." + Utilities.makeString(newDate.get(Calendar.YEAR),4); System.out.println("nouvelleDateProchainControle : "+nouvelleDateProchainControle);
[ Modéré par vedaer ]
-> Ajout du tag dans le titre
[ Merci de respecter les Règles du Forum ]
Partager