db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: timestamp question
Date Wed, 03 Sep 2008 13:30:23 GMT
Mikael <mikael-aronsson@telia.com> writes:

> Ok, thank's, I tried a few things and I think I got it working.
>
> If I convert any local time to UTC in an SQL query string
> and use an UTC calendar in getTimestamp( x, cal) and
> setTimestamp( x, cal) I think I got it working.
>
> The time specified as a string in a query is used as it is,
>
> setTimestamp with an UTC calendar converts the
> local time in timestamp to UTC and saves it.
>
> getTimestamp with an UTC calendar converts the
> UTC time in the resultset to local time.
>
> With this setup everything should be UTC time
> in the server and then I can convert it to local
> (norwegian or swedish ;o) time when it arrives
> to the client.

Yes, this is correct. The test I referred to in my previous post used
an explicit calendar object which just represented the current time
zone and this made no difference. A calendar object explicitly created
for another timezone (e.g. UTC), does make a difference.

Dag

Mime
View raw message