Conversion mapping is losing time zone data during daylight saving time

We have a problem with conversion of Calendars to timestamp with timezone for the last hour of Daylight Saving Time (e.g. 01:00 EDT - 01:59 EDT) where it is being interpreted as Standard Time which is in reality 60 minutes later.
We've written a JUnit test case that runs directly against TopLink to avoid any issues with WAS and its connection pooling.
The Calendar theDateTime comes from an object called TimeEntry which is mapped to a TIMESTAMP WITH TIMEZONE field using conversion mapping with Data Type TIMESTAMPTZ (oracle.sql) and Attribute Type Calendar (java.util).
We are using:
Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build Patch for Bugs 5145690 and 5156075)
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
Oracle JDBC driver Version: 10.2.0.1.0
platform=>Oracle9Platform
Execute this Java:
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
TimeZone tzEasternRegion = TimeZone.getTimeZone("US/Eastern");
Calendar theDateTime = Calendar.getInstance(tzEasternRegion);
theDateTime.setTime(format.parse("10/29/2006 01:00 EDT"));
Persist to the database and execute this SQL:
SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
FROM time_table WHERE time_table_id=1
This provides the following results:
THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EST -5
The wrong time zone is in the database. It should be EDT -4. Let's test the SQL that should be generated by TopLink. It should look like the following.
Execute this SQL:
UPDATE time_table SET the_date_time = TO_TIMESTAMP_TZ('10/29/2006 01:00 US/Eastern','mm/dd/yyyy HH24:MI TZR') WHERE (time_table_id=1)
SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
FROM time_table WHERE time_table_id=1
This provides the same results:
THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EST -5
Now, execute this SQL:
UPDATE time_table SET the_date_time = TO_TIMESTAMP_TZ('10/29/2006 01:00 EDT US/Eastern','mm/dd/yyyy HH24:MI TZD TZR') WHERE (time_table_id=1)
SELECT the_date_time, EXTRACT(TIMEZONE_REGION FROM the_date_time), EXTRACT(TIMEZONE_ABBR FROM the_date_time), EXTRACT(TIMEZONE_HOUR FROM the_date_time)
FROM time_table WHERE time_table_id=1
This provides better results:
THE_DATE_TIME EXTRACT(TIMEZONE_REGION FROM the_date_time) EXTRACT(TIMEZONE_ABBR FROM the_date_time) EXTRACT(TIMEZONE_HOUR FROM the_date_time)
29-OCT-06 01.00.00.000000 AM US/EASTERN US/Eastern EDT -4
The correct time zone is now in the database. Let's test reading this with the following Java:
System.out.println("cal= " + theDateTime);
System.out.println("date= " + theDateTime.getTime());
System.out.println("millis= " + theDateTime.getTimeInMillis());
System.out.println("zone= " + theDateTime.getTimeZone());
This provides the following results:
cal= java.util.GregorianCalendar[...]
date= Sun Oct 29 01:00:00 EST 2006
millis= 1162101600000
zone= sun.util.calendar.ZoneInfo[id="US/Eastern",...]
The TimeZone object is correct since we are using the US/Eastern regional time zone, but the millis are wrong which makes the time EST instead of EDT. The millis should be 1162098000000.
The conversion from java.util.Calendar to TIMESTAMPTZ loses the actual offset when setting to a regional time zone. It can maintain this info by specifying it explicitly.
The conversion from TIMSTAMPTZ to java.util.Calendar also loses the actual offset even if the correct offset is in the database.
Has anyone else encountered this conversion problem? It appears to be a conversion problem in both directions. I know that the Calendar is lenient by default and will assume Standard Time if time is entered during the repeated 1 o'clock hour at the end of Daylight Saving Time, but the Calendars we are using are explicit in their time, so this would be classified as data corruption.
Nik

Opened an SR. Looks like there is a problem with conversion either in TopLink or in JDBC.

Similar Messages

  • Problem with SLQ Date and Daylight Saving Time

    Hi everybody!
    It seems, that when I have a date in the database, which falls on start of the daylight saving period, it is converted to the previous date.
    Example: '2001-10-13' will become '2001-10-12' after doing a date = rs.getDate() and then converting back using date.toString().
    This caused a lot of trouble because the date value is part of an unique key constraint!
    Currently I wrote a wrapper method, which obtains the date as string and converts this one into a date by setting the hours to 12:00.
    Does anybody know a straighter way to avoid the conversion?

    Because the default time zone is using day light saving time. To remove this feature, reset your default time zone at the very beginning of your program:
    TimeZone.setDefault( new SimpleTimeZone( TimeZone.getDefault().getRawOffset(), TimeZone.getDefault().getID() );

  • Converting unix timestamp to date after Daylight Saving Time change

    Hello,
    in one of the products we use the internal scheduler stores dates (and times) in an Unix-like format, that is seconds since 1st of January 1970. We have used this SQL to extract the actual date:
    TO_CHAR(t.next_fire_time/(24*60*60*1000) +to_date('19700101020000','yyyymmddhh24miss'),'yyyymmddhh24miss')
    Everything worked fine until the time has changed this weekend from UTC+2 to UTC+1 (we are located in Eastern Europe). Since then the query above returns one hour later than it should.
    I.e. timestamp *1320067800000* is returned as *20111031153000* even thought correct is (and the actual time the event was scheduled) *31-OCT-11 02.30.16.000000 PM*
    I found queries like this on different forums and no one seems to worry much about the daylight savings. Is this a configuration issue in the DB or is it a bug in our code?
    I tried selecting the SESSIONTIMEZONE and DBTIMEZONE and both were +1.
    Any help appreciated.

    Your problem is hard-coded 2hour offset:
    to_date('19700101<font size=5 color=red>02</font>0000','yyyymmddhh24miss')You need to calculate current offset to adjust it to current DST situation:
    with sample_table as (
                          select date '1970-01-01' + 1320067800000 / 1000 / 3600 / 24 dt_utc from dual
    select  dt_utc,
            dt_utc +
            extract(
                         timezone_hour
                    from
                         from_tz(cast(dt_utc as timestamp),'utc') at time zone 'Europe/Prague'
                   ) / 24 dt_prague,
            extract(
                         timezone_hour
                    from
                         from_tz(cast(dt_utc as timestamp),'utc') at time zone 'Europe/Prague'
                   ) tz_offset
      from  sample_table
    DT_UTC              DT_PRAGUE            TZ_OFFSET
    2011-10-31 13:30:00 2011-10-31 14:30:00          1
    SQL> SY.

  • Exchange Active Sync UTC Daylight Saving Time

    Color me a bit confused. I am attempting to write an IOS client application to communicate with Exchange ActiveSync and display calendar information. But I am seeing some conflicting information in the protocol docs when compared to what I am getting from
    Exchange. Either that or I am somehow misinterpreting one or the other.
    My intent is to save an appointment in my local database in Coordinated Universal Time and then have the UI read in the information and display it as appropriate to the local timezone. In this way an recurring appointment created before daylight saving time
    for Noon will still be at the same time of day in local time as an appointment created during daylight saving time for noon. But they are not.
    My understanding of the documentation is as such:
    In MS-ASCAL pdf section 2.2.2.40 (roughly page 34) it says for Start Time that : ...the value of this element is a dateTime data type as specified in MS-ASDTYPE section 2.3.
    Moving to MS-ASDTYPE section 2.3 (roughly page 7) the dateTime value is specified in the format of ISO-8601 and all dates are given in Coordinated Universal Time (UTC)
    Looking up coordinated universal time I see that UTC does not changed with the seasons as local or civil time does and therefore DOES NOT support daylight saving time. This makes sense, as DST is decidedly local and is ignored by many areas. You cannot know
    from the perspective of UTC whether or not to apply a DST offset without knowing what timezone and area the time represents, therefore no daylight saving time can be supported. Based on this information I should be able to just slap the dates into my database
    as they are and merely have the UI adjust itself to display them properly.
    However, as a tested I began seeing a divergence of an hour between the two appointments in the database before the UI has even read them. To confirm this I created two recurring appointments representing Lunch at 12 noon local time. One that starts on March
    1st 2014 (Standard Time) and one that starts on March 10th 2014 (daylight saving time) in the eastern timezone. This should be March X 2014 at 1700 hours in both cases should it not?
    In the WBXML/XML that I am receiving I am getting two different times. The appointment that starts during standard time gives me a start time of 20140301T170000Z. The appointment that starts after daylight saving time is in effect locally gives me 20140301T160000Z.
    The difference between the two times is 1 hour, which is the daylight saving time offset. It is my perception based on everything that I have read both in the microsoft protocol documentation and outside it that these two times should be the same and that whatever
    client that gets to display them should be the one putting the offset in place as needed. Noon local time is noon local time but local time is the province of the local municipality/timezone, not that of UTC.
    So my question is what exactly is going on here? Are the start/stop/date stamp date times in UTC or not. If they are in UTC, then why are they offset by an hour instead of being at the same time? Obviously outlook displays these correctly for local time,
    because both appear at noon. But in my case my database contains locally adjusted times instead of the UTC times I thought I was getting which is throwing off when those appointments appear in the UI.
    Can someone please clarify what's going on here and what I should be seeing?
    Thanks.
    E

    Thanks for the reply, however after doing what is said the problem still remains. I did not try the manual approach, because of the time that would take with calendars that change at least daily.
    I am running the latest update of ICal and IPod, you would think this would have been addressed with one of the updates to allow the sync to work correctly with 5th generation IPods.
    I am going to try and turn off day light savings time set the clock to a Central Time zone and see if that works, I do not cross time zones much, anymore.
    MacBook   Mac OS X (10.4.9)  

  • Time Zone data downoad failed for 7841 phones

    Hi All ,
    we have 100 above 7841 phones facing same issue , time changes automatically . when i check the status message it is showing as "time zone data download failed "
    CUCM - 8.6.2
    Firmware -  sip78xx.10-1-1-9

    Hi Reddy,
    have a look into this discussion
    https://supportforums.cisco.com/discussion/12187361/cisco-7821-phones
    regds,
    aman

  • Is PGI date beased on system date or user profile time zone date?

    Hi All,
    When doing PGI what date system will take as Actual good issue date ? whether the System Date or User local Time zone date which maintained in User profile. If you have any idea on this please share.
    Regards,
    Lakshmikanth

    Hi,
    You need to check with the basis team for settings this to your local time.
    You can also check the field Personal time zone of the user in t.code SU01. I am not sure this will update the timings in the database when the user performs some action.
    Regards

  • Time zone used fot GI/MAD time calculation

    Hi,
    We have been trying to define working shifts/ cutoff for shipping points. While scheduling SAP is using the user time zone to calculate the MAD time, GI time etc. I need it to use a specific time zone that I define and not the time zone of the user processing the document. There is a field for time zone at the point where we allocate the shift definition to the calendar but it is not working. Is there anyway to achieve this ? The strange part is that it is not considering the Planr or shipping point time zone , but the user time zone to do all calculations.
    Thanks,
    Hari.

    Dear Hari,
    Usually in SAP logisticss the standard is to take date and time from the
    location where the user is located, there is reasons for it for example
    imagine the case below:
    "A user is working in time zone EST (GMT-5h), the shipping point is in
    time zone CET (GMT+1h). At 11 p.m. the user enters today's date,
    May the 9th, 2011 as actual goods movement day. The system now
    calculates the date using the time zone of the shipping point and
    determines 05:00 CET as actual goods movement time. But this time
    refers to May, the 10th. After pressing <enter>, the date and time would
    again need to be adopted which is confusing for the user.
    If the date is kept unchanged, it is also not correct as then the date
    is in the past (May, the 9th, 05:00)."
    There is not a possibility to of one this system behavior in a way
    that suits fine in every situation.
    I have researched and found the following information though:
    If you enter a time in the dialogue it is independent where the user is.
    The systems takes it as time zone of the shipping point as long as the
    time zone is maintained there otherwise, the local time zone is taken.
    There is no calculation on the user input programmed as a date change
    could lead to confusion...
    Since the existence of the note 1596670 if you enter a time in the dialogue
    it is independent where the user is.
    Best Regards,
    Christian Rosa

  • How can I change the time zone while not changing the time

    Let me preface this by saying I know this may seem tiddling to many but it is somthing I am rather obsessive about.
    I took many photos while I was in Los Angeles.  I had changed my camera's clock and the clock in the MacBook Pro to Pacific Standard Time and my iPhone automatically did the same thing. When I loaded photos into Aperture on my MacBook Pro the time information was all correct, all photos tagged in PST.  I had some photos I took on my last day that I did not load into Aperture until I got home to Denver.  When I loaded these images into Aperture they still have the correct time that they were shot but now show as being taken on Mountain Standard Time.  If I change the time zone in Aperture then the image time is also adjusted to be one hour earlier.
    Is there any way I can change the time zone in Aperture while leaving the actual image time alone?

    Hello Mark,
    Aperture will display the "Date created" with respect to the time zone your system is set to, but the "Date" using the time zone the image was taken in.
    You can adjustthe Time Zone for individual images either on import or afterwards using batch change:
    Select the images you want to adjust, then select "Metadata -> Batch Change" from the Aperture Application menu:
    Click: Adjust Time Zone
    Set the Camera's Time Zone to the Time zone you set your camera to when you took the images, and the Actual Time Zone to the zone you want Aperture to use to display the date.
    Regards
    Léonie
    P.S:
    This works with most cameras, but there seems to be a bug with canon cameras when importing directly from the camera. Frank Caggiano recently started a thread, but right now I cannot find the link.

  • Daylight saving time causes a date error on 01/APR

    morning dears,
    we are facing an issue related to Daylight saving time, as the following:
    at any page on the system that contains a calendar if we choose the date 01/04/2012 it generate an error...
    example on this error :
    on Leave Request page --> when choosing 01/04/2012 then clicking on calculate duration-->
    01/04/2012 is not a valid date. Please re-enter.
    any suggestions??

    dears any suggestions to solve the issue??
    have anyone faced this before?

  • OS has wrong time zone, so db has wrong time zone after RAC db installed

    hi Guru, after the RAC db installed, and it is a alive production DB, then I realized that the os has wrong time zone which is MDT (mountain time), I want it as CDT, so I am planning to ask sys admin to change os to CDT, then I just need to bounce the db once os time zone changed? Is that right? that won't corrupted the db after os time zone change right? And this is 2 nodes RAC db, anything I need to be aware before os level timezone change?

    Hello;
    Fix the time on the OS and restart the database and you should be done. Simple as that. So to answer your question Right.
    Best Regards
    mseberg

  • Oracle WebLogic Server (WLS), Time Zones, and DayLight Saving Time (DST) Changes

    Hello,
    We are approaching this time of the year again...
    I would like to redirect you to the Support Note 1370083.1 "Oracle WebLogic Server (WLS), Time Zones, and DayLight Saving Time (DST) Changes"
    This note lists what is to be expected from WebLogic Server regarding this time change period, in terms of behavior, both for the engine and the applications deployed onto WLS.
    Regards,
    Patrick.

    Probably this:
    http://www.jdocs.com/castor/0.9.5.3/api/org/exolab/castor/xml/handlers/DateFieldHandler.html

  • CreateODBCDateTime monkeys with Daylight Saving Time!!

    If one uses CreateODBCDateTime to convert a date into the
    proper format for storing in a SQL Server database, and one runs
    this operation on a date between 0200 and 0300 on the day that
    Daylight Saving Time changes, the function will change the time
    forward or backward one hour. IT WILL DO THIS EVEN IF THE DATE YOU
    ARE STORING IS UTC, thus rendering UTC times INVALID because they
    do not have DST. Why does this function monkey with DST at all?

    I have several international web sites on this server, one of
    which has over 100,000 users who have contributed over 70 million
    records, all with UTC timestamps. The problem occurs during the one
    hour period EVERY YEAR when daylight saving time is started. It
    does not do this in the fall when the time reverts. So, yes, the
    problem only occurs during 1 hour out of 8,760 hours, but when you
    start with 70 million records over 5 or 6 years...
    But the danger is for anybody who stores or manipulates a
    date/time OTHER THAN the date/time that is being used internally to
    the server. In other words, if your server is set to Central Time,
    and you have users in Hawaii or Arizona who need to store their own
    date/time, it is likely to apply Central Timezone RULES to that
    date/time, even if Hawaii and Arizona don't use DST.
    Let's say you're scheduling operating rooms in a hospital in
    Honolulu. All the CF routines are going to make sure to shift those
    times forward an hour without warning, have a nice day. In my case,
    it is happening with UTC, but it could be ANY time zone that has
    different rules than the ones on your server.
    Yes, I can probably figure out a different way to process
    times, but this is a massive system with thousands of different
    templates. In fact it affects several pretty massive software
    systems with millions of lines of code, so it's not as if I can
    just change a few SQL queries and be done with it.
    It probably should be a rule for anybody operating a
    ColdFusion server in an international setting, where dates and
    times from different regions might need to be stored in a database,
    to set up the server on UTC time just to avoid this problem.
    Me, I have to
    a. find all the places this will affect in thousands of lines
    of code,
    b. try to decide what impact going to UTC on the server will
    have on things like scheduled tasks, email servers, etc,
    c. then figure out whether there is any way to repair tens of
    thousands of corrupted records

  • Cisco ISE 1.2 Daylight Saving time

    Does ISE support DST change?

    Time Zone = UTC is best practice for a distributed deployment.  Also, remember that if you change the time zone on an ISE, the database is deleted!  So, set this during initial setup.  BTW, for the Eastern Time Zone in the United States, use EST5EDT in order to allow for Daylight Saving Time.

  • Brazil Daylight Saving Time Problem

    In Brazil, we enter the summer time and my blackberry 9800 torch automatically work, but when I synchronized with the playbook, some problems arose.
    The time in the menu setting is correct, as you can see in this image:
    But the wrong time remains the main screen:
    Does anyone have the same problem and knows how to fix it?
    tks,

    It did not work.
    It is indifferent to select manual or automatic, the problem persists.
    I'm in Brazil and with the correct time zone, but we are on daylight saving time.
    On the menu setting time and date, the time is right, however, in early 1 hour on application clock and and late 1 hour on the main screen.

  • Clock UI control and daylight saving time.

    Hi,
    We have a customer that has several sites around the world.
    In a VC-model I like to use the Clock UI control to display the times of the different sites.
    This can be done by setting the ‘time zone’ in the control properties.
    A long ago we have introduced ‘daylight saving time’.
    It seems that the clock control does not do anything with this ?
    How can I change the time zone when the model is running ?
    Can it be done by an expression and how ?
    There is also a problem of the country, some have DST, others don’t.
    See http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world
    Example:
    I have 2 clocks and the end-user lives in Amsterdam:
    Amsterdam, time zone = GMT + 1
    Santiago, time zone = GMT – 4
    During the winter in Amsterdam it is summer in Santiago and has ‘daylight saving’ so the time in Santiago should be GMT – 3 in stead of GMT -4.

    With the current version of VC / flash, it is not possible to display the correct time all the year 'round.
    If you only want to show the (user) current time then you can use this VC clock object.
    If you need to show clocks from different cities around the world, than its better NOT to use the VC clock.
    Because you can not define the country and city in the clock properties, that determine the use of DST, it will not always show the correct (default / DST) time.
    Solution:
    Add a HTLM-view to your model with a links to a web clock.
    Nice (free !) clocks can be found (and customized) on <a href="http://www.worldtimeserver.com/clocks/wtsclock001.aspx">worldtimeserver.com</a> or <a href="http://www.timeanddate.com/clocks/free.html">timeanddate.com</a> .
    Example:
    For the city Santiago (Chile) the URL =
    http://free.timeanddate.com/clock/ielrw91/n232/tluk/fn13/fs16/fc009/tt0/tw1/td2/th1/ts1/tb4

Maybe you are looking for

  • Formatted .data file, reading in and creating an array of objects from data

    Hi there, I have written a text file with the following format; List of random personal data: length 100 1 : Atg : Age 27 : Income 70000 2 : Dho : Age 57 : Income 110000 3 : Lid : Age 40 : Income 460000 4 : Wgeecnce : Age 43 : Income 370000 and so on

  • Strange Outline Appears

    We have a machine (G5) that randomly makes a black outline around file names, objects, images in PS, in the finder and what-have-you. Please see the links provided for screen shots. Any clue why this is happening? This machine is running 10.4.7. imag

  • Installed v8 and now itunes won't open

    I upgraded to V 8 and now itunes won't open. Saying my audio configuration not right. Anyone know how to fix this?

  • Mavericks install created a standard user account

    I'am locked out of making any changes as the padlock unlock keeps asking for Admin Name and Password. Also Was going to try and migrate my account from 10.6.8 but Migration Assistant is also refusing to open.

  • Setting Profile Parameter in Mini SAP

    Dear experts, Is it possible to set / edit a profile parameter in Mini SAP? I opened transaction RZ10. When I pressed F4 on the 'Profile' field, I received a message saying 'No profile found'. I'm using SAP Netweaver 2004s ABAP Trial Version 7.00. Th