Re: application displays date off by one day

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: Tue, 8 Jan 2008 05:38:58 -0800 (PST)
Message-ID: <86260f8c-9cbe-4233-bcfa-f084e92be59f@n20g2000hsh.googlegroups.com>


On Jan 7, 10:16 pm, kcu..._at_gmail.com wrote:
> On Jan 7, 12:04 pm, "allen.dar..._at_gmail.com" <allen.dar..._at_gmail.com>
> wrote:
>
>
>
> > On Jan 7, 10:51 am, kcu..._at_gmail.com wrote:
>
> > > I have an application developed in JDeveloper 10.1.2.1.0 that is
> > > displaying dates incorrectly.
>
> > > This seems to be related to some Time Zone setting.
>
> > > If the date is 2006-03-20 00:00:00.0 is displays as 2006-03-19.
>
> > > If the date is 2006-03-20 01:01:00.0 is displays as 2006-03-20.
>
> > > Value is stored as a Date.
>
> > > Any suggestions?
>
> > > KSC
>
> > Can you query a table and see what time zone setting you are in?
>
> From SQL:
>
> select current_timestamp from dual
>
> > 2008-1-7 13.40.xx.xxxxxx America/New York
>
> select dbtimezone from dual
>
> > EST
>
> From Java:
>
> Date = Monday Jan 07 13:40:xx EST 2008
>
> > at 13:53
>
> Calendar = java.util.GregorianCalendar
> [
> time=1199732965985,
> areFieldsSet=true,
> lenient=true,
> zone=sun.util.calendar.ZineInfo[
>
> id="America/New_York",
> offset=-18000000,
> dstSavings=3600000,
> useDaylight=true,
> transition=235,
> lastRule=java.tuil.SimpleTimeZone[
> id="America/New_York",
> offset=-18000000,
> dstSavings=3600000,
> useDaylight=true,
> startYear=0,
> startMode=3,
> startMonth=3,
> startDay=1,
> startDayofWeek=1,
> startTime=7200000,
> startTimeMode=0,
> endMode=2,
> endMonth=9,
> endDay=1,
> endDayofWeek=1,
> endTime=7200000,
> endTimeMode=0,}},
> firstDayofWeek=1,
> minimalDaysinFirstWeek=1,
> ERA=1,
> YEAR=2008,
> MONTH=0
> WEEK_OF_YEAR=2,
> WEEK_OF_MONTH=2,
> DAY_OF_MONTH=7,
> DAY_OF_YEAR=7,
> DAY_OF_WEEK=2,
> DAY_OF_WEEK_IN_MONTH=1,
> AM_PM=1,
> HOUR=1,
> HOUR_OF_DAY=13,
> MINUTES=52,
> SECONDS=45,
> MILLISECONDS=985,
> ZONE_OFFSET=-18000000,
> DST_OFFSET=0
> ]

Looks like either the database host time or the client host time is off by ca. 13 minutes (it says 13:40 at 13:53 if I'm reading your output correctly.) Setup the database host to synchronize with some NTP server to be sure its time is always correct. Setup time sync on client host to be sure your time is also correct.

Hth,

   Vladimir M. Zakharychev
   N-Networks, makers of Dynamic PSP(tm)    http://www.dynamicpsp.com Received on Tue Jan 08 2008 - 07:38:58 CST

Original text of this message