i figured out the root cause of the problem. 1) Java TIME ZONE is GMT ------------------- storing DATE (2008-10-19 which is in GMT )
2) storing the above date in GMT to mysql 3) MYSQL TIME ZONE IS GMT+05:30 4) as mysql time zone is GMT+05:30 it is viewing the date as (2008-10-19) @ GMT+05:30 5) when i retrieved the date from mysql (GMT +05:30) ---------------------------------Java (GMT) 2008-10-19 @ GMT+05:30 ------------------------------------------- 2008-10-18 18:30 (GMT) converted to the above is the reason why it is printing the previous day date. On Sun, Oct 19, 2008 at 1:15 PM, SK <[EMAIL PROTECTED]> wrote: > > > 2008/10/19 Rama <[EMAIL PROTECTED]> > > hi, >> >> iam using java,hibernate,mysql >> >> i am storing *19-10-2008 (*of type java.sql.Date) (TIMEZONE GMT) to >> mysql >> DATE field. >> >> when i retrieve the same date from mysql to java it is being displayed >> as >> *18-10-2008 18:30:00 GMT * >> >> >> i could not able to figure out what is going wrong . can any one please >> guide me on What can go wrong in above scenario? >> > there are a lot of mothods to express data in java,but in mysql only have > one type. > may be types not match. > > i think you should storing "19-10-2008" to mysql char(10) field. > > >> >> --rama >> > >