You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Emmanuel Dupont <em...@jwaretechnologies.com> on 2003/06/12 17:15:19 UTC

How Ojb drives Date datas ?

All,

 

I would like to know how Ojb drives the Date format. I have this trouble :

 

When I use in Java : 

 

      String strDate = "2003-06-13 15:01:01.555";

      SimpleDateFormat dformat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss.S");

      java.util.Date date = dformat.parse(strDate);

      long ldate = date.getTime();       

                                   

      Timestamp currentTime = new Timestamp(ldate);

 

      objectEdited.setDate_time(currentTime);

 

The objectEdited.Date_time is a Timestamp type.

 

 

The request to the Database is oK with this :

 

INSERT INTO table (id_pk, date) VALUES ( 20, '2003-06-13 15:01:01.555'); 

 

But when I modify the SimpleDateFormat, the request doesn't send the right
date.

 

I wonder how the request is perform and how OJB drives the Date datas ?

 

Could I have some trouble with the Database language ?

 

ThanX !