Skip navigation links

MySQL Forums :: JDBC and Java :: how can I get UTC Dates from UTC-configured server


Advanced Search

how can I get UTC Dates from UTC-configured server
Posted by: Den Orlov ()
Date: July 24, 2008 09:32AM

I use 5.1.6 connector/j, 5.1.21-beta server configured to work in UTC time zone. So all dates that are stored at DB are in UTC time zone. I use useLegacyDatetimeCode=false connection URL parameter.

My java client operates in MSK time zone. And I use this method to retrieve dates from my server in UTC also:

Date date = rs.getDate(names[0], (Calendar)UTCCal.clone());

where UTCCal Calendar in GMT time zone.

Using that call I get date that have minutes, hours and seconds equal to the date that I have in DB but in MSK time zone! Or in another worlds that call:

date.getTime()

doesn't correspond to milliseconds since epoch of date that are stored in DB.

Is this a bug? Might be I missed some URL connection parameter that should be used for my case?

Options: ReplyQuote


Subject Written By Posted
how can I get UTC Dates from UTC-configured server Den Orlov 07/24/2008 09:32AM


Sorry, you can't reply to this topic. It has been closed.