Hy,
Here i have a problem with date.
i am storing a date as sting in oracle9i the format is
19-JAN-2003 like.
while it is retrieving it gets changed.
in to 2003-01-19 00:00:00: like
how can i get the original one from database.
by
-
Problem with DATE...help me.. (3 messages)
- Posted by: Maruthi Ram
- Posted on: March 31 2004 04:08 EST
Threaded Messages (3)
- Using java.text.SimpleDateFormat by cnzeng zheng on March 31 2004 10:04 EST
- Problem with DATE...help me.. by Martial Krawier on March 31 2004 10:14 EST
- SQL by Chuck Kulchar on April 02 2004 16:29 EST
-
Using java.text.SimpleDateFormat[ Go to top ]
- Posted by: cnzeng zheng
- Posted on: March 31 2004 10:04 EST
- in response to Maruthi Ram
That's easy to format date . -
Problem with DATE...help me..[ Go to top ]
- Posted by: Martial Krawier
- Posted on: March 31 2004 10:14 EST
- in response to Maruthi Ram
Hi,
Simply use a DateFormat object
Here is a sample of code adapted from Sun tutorial ...
//your code here
Date date = resultSet.getDate(index);
String dateOut;
DateFormat dateFormatter;
dateFormatter =
DateFormat.getDateInstance(DateFormat.DEFAULT, currentLocale);
// check Sun tutorial for others formaters
today = new Date();
dateOut = dateFormatter.format(today);
System.out.println(dateOut + " " + currentLocale.toString());
Hope it helps .... -
SQL[ Go to top ]
- Posted by: Chuck Kulchar
- Posted on: April 02 2004 16:29 EST
- in response to Maruthi Ram
Try to change your retrieval code from the sql to something like
select to_char(yourDate, 'DD-MON-YYYY') genericName from yourDB
That should return a string in the form of the way you're storing it.
hth
Chuck