« Return to Thread: Changing time zone after getting GMT time from database

Re: Changing time zone after getting GMT time from database

by Fabian Groffen :: Rate this Message:

| View in Thread

Hi Majid,

On 27-05-2012 05:37:32 -0700, Majid Azimi wrote:
[snip]
> But there is no difference between timestamps in database
>
> and timestamps after converting time zone in application.
> Could anyone help?
> Is this the wrong way to convert TimeZone?

I'm not sure I understand what you want.  The example code you showed
looked daft, since you seem to be changing timezones on the fly.

The Driver accomodates for your timezone, that is, the timezone that's
default in your JVM when it makes a connection to the database.  If you
want to use another timezone for timestamps/times/dates than the default
of your JVM, then set the desired timezone before creating a new
connection to the database (DriverManager.getConnection()).

If you have a scenario where many timezones are involved in retrieving
and storing timestamps, you probably best use TIMESTAMP WITH TIMEZONE
instead to save yourself a lot of trouble.

Fabian


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MonetDB-users mailing list
MonetDB-users@...
https://lists.sourceforge.net/lists/listinfo/monetdb-users

signature.asc (498 bytes) Download Attachment

 « Return to Thread: Changing time zone after getting GMT time from database