| Author |
Date format
|
Fernando Dominguez
Ranch Hand
Joined: Sep 01, 2006
Posts: 93
|
|
Hello, I have this sql date 2009-05-11 00:00:00.0 in to my data base String fecha = rs.getString("fecha")); // fecha is now 2009-05-11 java.text.SimpleDateFormat df= new SimpleDateFormat("dd-MM-yyyy"); java.util.Date d = df.parse(rs.getString("fecha")); System.out.println(d); //shows Thu Oct 29 00:00:00 CET 16 It doesn't retieve the year , I also trying to convert with <fmt:formatDate value='${documento.dateFecha}' type="date" pattern="dd-MM-yyyy"/> and i get 29-10-0016 I wnayt to get day- moth-year; why i lost the year? thanks
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
Look at the format of your string. Look at the pattern you are passing to SimpleDateFormat. It's not really surprising you are not getting the data you want.
|
Joanne
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
|
Looks like "2009-05-11" will parse better with "yyyy-MM-dd". Let us know if that helps.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Date format
|
|
|