Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Universal date/time in Oracle and JDBC
Hi Kevin,
store the the UTC date as a long in the database. Then when the java client pulls the date (specified as long), take it and throw it into a java.util.Date type. The java client will then use the client time-zone to interpret the the date correctly.
hth,
cindy
Kevin Dean wrote:
> I am developing an application that has to span multiple time zones. In
> order to facilitate this, the clock on the database server is set to UTC.
> The problem I am having is that Oracle or its JDBC driver don't seem to
> understand this idea of spanning multiple time zones:
>
> 1) I enter a date/time in Eastern Daylight Time as today at 13:30; I would
> like the database to store it as today at 19:30 (UTC = EDT + 4).
> 2) Another application in Central Daylight Time retrieves the record; I
> would like that application to see the date/time as today at 12:30.
>
> The problem I'm having is that Oracle stores the date/time based on the time
> zone in which the date was entered; i.e. no matter what machine I go to the
> JDBC driver returns the date/time as today at 13:30.
>
> Is there any way to tell the JDBC driver that all dates are UTC? I really
> don't want to have to write wrappers around all my date selects, inserts,
> and updates. Any help would be greatly appreciated.
>
> --
> Remove NOSPAM woven into e-mail address to reply directly.
Received on Fri Jun 01 2001 - 14:12:06 CDT