SQL Date Format

Hi All,

I have a method which takes as argument java.sql.Date and adds it to the oracle database. Now the format of the date added is :

3/5/2007

I want the date to be displayed in the database as :

3/5/2007 4:23:55 PM

i.e along with the time. I am using jdk1.4 and oracle 9i

Please suggest a solution for these.

Thanks and Regards

Chirayu Pradhan

[402 byte] By [Chirayua] at [2007-11-26 20:33:15]
# 1
please read the api for java.sql.Date and java.sql.Timestamp. This will help you.
g_magossa at 2007-7-10 1:24:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> Hi All,

> I have a method which takes as argument

> java.sql.Date and adds it to the oracle database. Now

> the format of the date added is :

>

> 3/5/2007

>

> I want the date to be displayed in the database as :

>

> 3/5/2007 4:23:55 PM

> i.e along with the time. I am using jdk1.4 and oracle

> 9i

>

> Please suggest a solution for these.

>

> Thanks and Regards

> Chirayu Pradhan

Can you change your method to accept a Timestamp variable instead of a Date variable? I have had no problems inserting variable of type Timestamp into a database field of type Date. Im also using jdk1.4 and oracle 9i. I don't think java.sql.Date allows for time as selecting from a resultset (rs.getDate("Date_Field")) will only return a date, not the time.

marsuia at 2007-7-10 1:24:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...