DBConnect Daylight saving conversion
Hello Experts,
I am trying to extract data from Oracle Database tables and their Date format is Daylight saving and using their Oracle side function to convert it to "mm/dd/yyyy hh:mm:ss" is taking a lot of time while extraction.
So, i am tying to replicate the following code in SAP:
FUNCTION DATE_TIME_CONV (dRemedyDateIn IN NUMBER)
RETURN DATE
IS
dDateOut DATE;
BEGIN
IF dRemedyDateIn is NULL THEN
RETURN NULL;
END IF;
dDateOut := TO_DATE('12/31/1969 16:00:00','MM/DD/YYYY HH24:MI:SS') + ( dRemedyDateIn/ ( 60 * 60 * 24 ));
IF ( dDateOut < DAY_LIGHT_SAVING_STARTS(dDateOut) )
OR ( DAY_LIGHT_SAVING_ENDS(dDateOut) <= dDateOut ) THEN
dDateOut := TO_DATE('01/01/1970','MM/DD/YYYY') + ((( dRemedyDateIn / 60 / 60 )- 8) / 24 );
ELSE
dDateOut := TO_DATE('01/01/1970','MM/DD/YYYY') + ((( dRemedyDateIn / 60 / 60 )- 7) / 24 );
END IF;
RETURN dDateOut;
END DATE_TIME_CONV;
Did somebody have come across this scenario?
Thanks
Arun
try to play around with these function modules..
GET_SYSTEM_TIMEZONE
TZ_LOCATION_TIMEZONE Time zones: Determine time zone for a location (land, region)
TZON_GET_OS_TIMEZONE
TZON_LOCATION_TIMEZONE
TZON_CHECK_TIMEZONE
TZON_GET_TIMEZONE_TEXT
TZON_GET_USER_TIMEZONE
Similar Messages
-
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.
NikOpened an SR. Looks like there is a problem with conversion either in TopLink or in JDBC.
-
Change a timestamp in one timezone to another with the DayLight Saving
Hi Guys!
I need to change a timestamp in one timezone to another timezone with the Daylight saving time(DST).
I can easily convert a given timestamp to a different location timezone by the use of TimeZone class in java, but found myself unable to modify it relative to the
Daylight saving time(DST).
I Just want to know that the companies, that are having the International clients then, how they handle these kind of things where they need to track down the user
activity in that client(End-User) side timezone, with that Daylight Saving Time.
I am very new to this Daylight saving time concept so if anybody knows about it anything, then plz help me out.venus_goyal wrote:
Hi Guys!
I need to change a timestamp in one timezone to another timezone with the Daylight saving time(DST).
I can easily convert a given timestamp to a different location timezone by the use of TimeZone class in java, but found myself unable to modify it relative to the
Daylight saving time(DST).No you don't. All Java timestamps are stored as a "epoch time" i.e. number of millisecondsseconds since 1/1/1970 GMT.
Conversion to and from local dates and times is done when converting between stored Date objects and String values from input or for display.
This happens in DateFormat or Calendar, and DST information is included in the Locale information passed to either class. -
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() ); -
Function module for knowing if Time falls in daylight saving.
Hello All,
Can any one tell if we have any FM to know if the date falls in Daylight saving period so that i can make the conversions according to the output.
If there is no FM, please provide the procedure to find it.
Thanks,
Ravindra.Hi,
Try TSTR_CALC_DURATION and TSTR_CALC_TIME these two will be usefull.
Thanks,
Madhukar -
I have an E51 and live in Darwin, Northern Territory.
There is no timezone for Darwin provided by Nokia, just Adelaide, also on Central Standard Time.
Now Adelaide has moved to dalight saving; Northern Territory time does not change.
I can correct the time manually on my phone but all my appointments from Outlook are on Adelaide time on my phone, Darwin time in Outlook on my PC.
Any ideas?I am in Darwin also but I am on a network so my computer time has to remain as is. Nokia can handle daylight saving for Adelaiude but has not yet developed the software to enable the networks to recignose that the NT does not have daylight saving.
Keep complaining, folks - that makes it more likely that something will be done about the issue.
I sent the following to the local paper - which may or may not publish it:
"I wonder how many other people in the NT share my current frustration?
If I synchronise my computer calendar with my mobile phone now that SA is on daylight saving, all my appointments are I hour out as they are on Adelaide time.
After frustrating email correspondence with Nokia and phone conversations with multiple people at Telstra (who provided my Nokia phone) I am being told that it is a network problem.
My computer recognises my time zone as GMT+0930 (Darwin) but my mobile phone only offers time zones for Adelaide, Brisbane, Canberra, Melbourne Perth and Sydney (and can adjust to their daylight saving regime). However I am told that software is not yet developed to enable those of us who do not share the SA daylight saving period to remain on true local time.
Curiously enough earlier models of mobile phones apparently did not have this difficulty, nor do all current models. If you do not try to synchronise all will be well as long as you adjust the actual time read out on your phone. Synchronising is, however, impossible!
If anyone has a solution or can persuade Nokia and other mobile phone manufacturers to ensure that all their models can be on correct local time anywhere in Australia you will be doing a significant service!" -
IMessage beta loose all saved conversations when I open and close a window.
iMessage beta looses all saved conversations when I open and close a window.
Just reporting this bug... Could not find anyother place to do it.
JonathanI thought it was doing that also. But I found that if I start a new chat with someone I was messaging before, then the old messages re-appear in the messages window.
-
Daylight saving in the NOkia 6233 ?
Does the Nokia 6233 support Daylight Saving ? If yes, how can I set it in my phone ?
It doesn't do it automatically, like a PC...it isn't that clever. You need to change it yourself. Be sure to set the time zone rather than change the clock, otherwise the phone may display incorrect times for SMS messages etc.
Chris
6230i (the last bug-free Nokia?)
Vodafone UK contract since 1992 -
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.
-
Date Time in Coldfusion at Daylight Saving
Hi
In coldfusion, I have problem creating Date Time using CreateDateTime when the daylight saving switch. For example
CreateDateTime(2011,3,13,2,0,0) gives error.
Also if you do like this
DateAdd('h',1,CreateDateTime(2011,3,13,1,0,0)) gives "2011,3,13,3,0,0" ie instead of 2AM it returns 3AM. This is happening every daylight saving switch time.
This is a bug in coldfusion?
It should be fixed by Coldfusion.
ThanksOn 3/17/2011 12:39 AM, Paresh_Patel said:
>
When we loop through the 24 hours on daylight saving day e.g
>
<cfset startDate = CreateDateTime(2011,3,13,0,0,0)>
>
<cfoutput>
<cfloop from="1" to="22" index="dayNo">
<cfset startDate = dateAdd('h', 1, startDate)>
#hour(startDate)#<br>
</cfloop>
</cfoutput>
>
This will show wrong hours (2 is missing)
and that means you've fallen into timezone hell. -
Oracle 11 driver causes problem in the day when the daylight saving starts
Hi everybody,
I'm facing a really weird problem with daylight saving stuff. So, let me explain:
I have a table where stores some personal data, which one of the columns is a birth date.
On this column there is a constraint like: TRUNC(BIRTHDATE) == BIRTHDATE to ensure that the is the same always.
Now the problem starts:
When a person is born when the daylight saving starts (+1 hour) (e.g: Belgium 22/04/1930) in our Java application
that date is described like: Sun Apr 22 00:00:00 CEST 1923
When the application tries to insert data into the table, it gets a constraint violation exception.
The configuration I'm using:
- JDK 6_0_21
- Oracle driver: 11.2.0.1.0 (ojdbc6.jar)
- Oracle database: 10.2.0.4.0
Now the weird part: When I change back to the previous Oracle driver version (10.X), it works perfectly. I've seen this FAQ:
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_01
and tried both solutions: Set the mapDateToTimestamp property and change from DATE to TIMESTAMP type in the table. Unfortunately, both don't
work.
Anybody has an idea how to solve that? (Change back to the previous version is not an option for us, since we had transactional problems with it)
Cheers,
BrunoYou might want to post on ODBC
-
Switch to standard time from daylight saving causes error - iOS 7
Hi there,
Today (27-Oct-2013) the time was switched back from daylight saving to standard. When looking my iPhone, I noticed that although the clock correctly displays the current time, the standard weather app still uses the time according to daylight saving (i.e. showing one hour ahead) and what is more interesting, the calendar acts weirdly, showing the correct time, but placing it in the old daylight saving time, i.e. 7:46 AM is shown as a line between 8:00 AM and 9:00 AM! It is really ridiculous and it seems I cannot change these. I restarted my iphone, turned off and on again using carrier provided time, but nothing changed. Any clues?
Using iPhone 5 and iOS 7.0.2.
Any help is appreciated.Problems with time, time zones have been quite common. Clearly, my brand new, the most forward thinking smartphone has the same bug. Sometimes I wonder why Apple is unable to get basic things work? they simply don't care, that's all.
Issue with the line materializes itself on my iCal on iMac as well
I hope, at least alarm will go off at the right time Monday morning
BTW: last year when I was on trip to Chile, at one night - suddenly - out of the blue - time changed on all our apple devices.. it's bad when you've got your flight next day and don't know when to wake up weeks later I have found out information Apple did not update their list of timezone changing dates.. for couple of years... -
Alarm clock, recurrence does not work after daylight saving in Sydney
Any iphone 4 users having the same problem since daylight saving?
It woke me up 1 hour before the set alarm time, e.g. 5.55am instead 6.55am
The one off alarm works fine.
IOS4.1 + Itune 10Use the search box before posting "new" threads.
http://discussions.apple.com/thread.jspa?threadID=2603262&tstart=0 -
Daylight Saving Time Patch in 10.2.0.4
Question:
When you apply the 10.2.0.4 patch (linux-64 bit), does this patch include the daylight saving time patch that needed to be applied in earlier releases?I know that. I was looking for the readme file but my metalink account did not have access to it. I was hoping that the forum would fill in the gap for me.
In this situation, I should have installed the 10.2.0.1 database, then the DST patch and then the 10.2.0.4. Instead, I got ahead of myself and did the 10.2.0.4 patch first. I was just wondering if the DST patch was included in the 10.2.0.4 by now. The good news is that I had my metalink updatred so I have access to the readme file now. I'm glad you knew the answer. Oh wait, you don't. -
When syncing my iPhone to Microsoft Outloook all the full day appointments become two day - 2300hrs to 2300hrs next day. Sometimes this will include a nuber of a single day of 23 hours. Looked at solutions and all point to a clock issue or a daylight saving and winter times. Outlook operating time is directly from the Windows clock that incudes the change of times for daylight saving etc. It is set for UTC Dublin, Edinburgh, Lisban, London with daylight saving included in the options. I can't see what I can do.
When syncing my iPhone to Microsoft Outloook all the full day appointments become two day - 2300hrs to 2300hrs next day. Sometimes this will include a nuber of a single day of 23 hours. Looked at solutions and all point to a clock issue or a daylight saving and winter times. Outlook operating time is directly from the Windows clock that incudes the change of times for daylight saving etc. It is set for UTC Dublin, Edinburgh, Lisban, London with daylight saving included in the options. I can't see what I can do.
Maybe you are looking for
-
I'm running Thunderbird 31.6.0 on Windows 8.1 with BitDefender 2013. PROBLEM: When getting email, Thunderbird freezes and displays "Not Responding" in screen header. When TB is closed then reopened, a popstate folder (popstate-1.dat) is added to acco
-
CodePage mismatch when creating Informatica Service
I am installing INformatica in Windows, connecting to an Oracle DB in a Linux environment. I can create (and enable) the repository service if and only if I choose Western ISO8859 as Database properties. When creating the PC Integration service I am
-
How Do I Text Without Blackberry Predicting words??
Hello, I just purchased the Pearl 8120 and cannot figure out how to type anything to include texts and new contacts without the auto text (think that is the name) predicting my words. I have already gone into settings and disabled auto text but that
-
How to set html bullet effect for text in text area
Hi All, How can i set html bullet effect for my text in text area. i need like hello world Can any help me. thanks Raghu
-
How do I stop LR4 from organizing imported files into a folder by date.
How do I stop LR4 from organizing imported files into a folder by date. Most times when I import files I have already created a folder and sub-folder structure tyat I want to use. I then right click the desired folder and choose import into this fold