Bonjour,
j'ai un problème avec la conversion de string en date.
en fait j'ai le string suivant 29/07/2009 , après la conversion j'ai ceci Sat May 07 00:00:00 CEST 2011.
j'ai utilisé trois méthodes , mais tous on fait la même chose :
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 public static Date stringToDate(String sDate) throws ParseException { return formatter.parse(sDate); } public static Timestamp toDBDateFormat(String sDate) throws ParseException { return new Timestamp(stringToDate(sDate).getTime()); } public static Date stringToDate1(String sDate, String sFormat) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(sFormat); return sdf.parse(sDate); }
merci pour votre aide.
Partager