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.
Thanks

On 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.

Similar Messages

  • Query a date column in consideration of daylight saving zone

    Hi!
    I have a database (oracle 9) column with dates that have an offset of one or two hours, one hour when the date is in winter time and two hours when the date is in summertime. I want to query the dates from the table and correct the date at the same time.
    Can anybody help me with this issue?
    Thx
    Christoph

    Hello
    It would be helpful if you could provide a small test case that shows the data you have and the result you expect. For example...
    WITH src AS
    (  SELECT TO_DATE('15/08/2011 12:00','dd/mm/yyyy hh24:mi') a_date, 1 offset from dual union all
        SELECT TO_DATE('15/08/2011 12:00','dd/mm/yyyy hh24:mi') a_date, 2 offset from dual union all
        SELECT TO_DATE('15/08/2011 23:59','dd/mm/yyyy hh24:mi') a_date, 1 offset from dual union all
        SELECT TO_DATE('28/02/2011 23:59','dd/mm/yyyy hh24:mi') a_date, 1 offset from dual
    SELECT
        a_date,
        offset,
        a_date + numtodsinterval(offset,'HOUR') new_date
      FROM
            srcHTH
    David
    Edited by: Bravid on Aug 15, 2011 11:05 AM

  • 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)  

  • Problem in Date time Zone parsing

    Hi Guys,
    I want format of String of time whic have time zone also. But how can i validate weather my date is correct or not .
    This is i am doing because of Auto grow up problem in SimpleDateFormat.
    For example : If i am parsing "2.00 AM GMT" as per mask "h:mm a z" should be correct if after format output is "2.00 AM GMT"
    but if i am trying "15.00 AM GMT" as per mask it should be invalidated because after format it will return "3.00 PM GMT" this is also working as per my expectaion
    But When i changed the Timzoe mask from GMT to PDT it get again fails
    suggesiotn for resolving this isse willl be appreciated
    // TODO Auto-generated method stub
    import java.util.Date;
    import java.util.TimeZone;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.SimpleTimeZone;
    public class checkDates {
         public static String getTimeZoneId(String getTimeZone) {
              // Modifies the default time zone, disables the Daylight Saving Time.
              TimeZone dtz = (TimeZone) TimeZone.getDefault();          
              int l_rawOffset = dtz.getRawOffset();
              String l_id =TimeZone.getTimeZone(getTimeZone).getID();          
              SimpleTimeZone l_simpleTimeZone = new SimpleTimeZone(l_rawOffset, l_id, 0, 0, 0, 0, 0, 0, 0, 0);
              TimeZone.setDefault(l_simpleTimeZone);
              return TimeZone.getTimeZone(getTimeZone).getID();
         public static void main(String[] args) {
              // String aMask = "MM/dd/yyyy";
              String aMask = "hh:mm a z";
              String newEffDate = "15:00 AM GMT+03:00";
              String timeZoneId ="";
              SimpleDateFormat mydf = new SimpleDateFormat(aMask);
              if(aMask.indexOf("z")>0){
                   if(newEffDate.length()>aMask.indexOf("z")){
                        timeZoneId = getTimeZoneId(newEffDate.substring(aMask.indexOf("z")));
                        System.out.println(newEffDate + " Time Zone id = ["+timeZoneId+ "]");
                        mydf.setTimeZone(TimeZone.getTimeZone(timeZoneId));
              Date date = null;
    /*          System.out.println(System.getProperty("user.timezone"));
              System.out.println(TimeZone.getDefault().toString());     
              System.out.println(mydf.getTimeZone().toString());     */          
              try {
                   date = mydf.parse(newEffDate);
                   System.out.println("\n\n\nDate is working -\nInput " + newEffDate);
                   System.out.println("Date is working -\nOUTPUT " + mydf.format(date));
                   if (!mydf.format(date).equals(newEffDate)) {
                        throw new ParseException("[" + newEffDate + "] Unparseable date: \"newEffDate\" " + "[" + mydf.format(date) + "] [" + aMask + "]", aMask.indexOf("z"));
              } catch (ParseException pe) {
                   pe.printStackTrace();
                   System.out.println(pe.getMessage() + "---" + pe.getErrorOffset());
    }

    There's a setLenient method you can use.

  • Another Date/Time Bug?

    I found now, that all my images from 10D and G2 have a wrong Date/Time Original in lightroom. It's shown one hour too early. All my other viewers show the correct time in exif data.
    The images from my 30D otherwise are correct in lightroom.
    What happens here?
    Juergen

    Ok, I looked a little bit deeper.
    All my pictures from end of october until end of march have correct time in lightroom. Daylight saving time begins last weekend of march and ends last weekend of october in germany.
    But I always change the time in my cameras on the first day after daylight saving time changes. It seems it hasn't anything to do with the camera model because I own the 30D only since last november.
    Why doesn't lightroom only show the exif times from the files and is calculating something wrong by itself?
    Juergen

  • Nokia N8 Daylight Saving Clock Issue

    I have discovered a issue with the clock on my Nokia N8 following the commencement of daylight saving here in Melbourne Australia.
    My device is set to "Automatic time update" & yesterday it adjusted the time for daylight saving by 2 hours instead of 1. It is now one hour fast.
    I have a feeling there may have something to do the phone confusing UK time for GMT time (UK still in daylight saving time to my knowledge).
    Anyone else have this issue?

    Mine is working fine, I changed from Brisbane to Melbourne, only moved forward an hour with automatic time update on.
    I'm using Belle though, perhaps when you get the Anna update it shall fix it.
    For now you might have to just turn the automatic updates off

  • 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.

  • 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() );

  • 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?

  • IPhone upgrade to 3.1.2. resets date time - no daylight saving

    I upgraded my iPhone 3GS to the new OS: 3.1.2 recently. I noticed the date & time were reset to some time way in the past so I reset them to the current date & time. I notice now there's no way in the Settings | General |Date & Time to automatically have the date & time synced with your PC and the iPhone doesn't take allowance of daylight saving time - I added London as a city for keeping track of my time and the Clock shows it as 10 hours behind Sydney time rather than 11, which would be the case if Sydney was set at daylight saving time.
    Does anyone have any suggestions as to how I can get my iPhone to recognise daylight saving time again? I can't see anywhere on the iPhone or iTunes to do it, I've tried resetting my iPhone. Nothing is working.

    I don't see a DST option either. I assume that Set Date & Time automatically did set from the phone network and that would include DST corrections. Mine is correct now and we are on DST here. Manual says:
    "Set whether iPhone updates the date and time automatically: Choose General > Date & Time and turn Set Automatically on or off.
    If iPhone is set to update the time automatically, it gets the correct time over the cellular network, and updates it for the time zone you’re in.
    Some carriers don’t support network time in all locations. If you’re traveling, iPhone may not be able to automatically set the local time."
    Phil

  • 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

  • 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...

  • 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.

  • Daylight Saving Time Changes in 2007 for USA

    Can anyone give me solution how to handle Daylight saving Time changes in 2007 in USA for JDK 1.3.x releases? We are using this due to some vendor dependency. We can�t upgrade to higher versions up to middle of the 2007. I would be thankful if somebody gets back to me.

    I have a similar issue where we cannot upgrade the jdk 1.1 without involving a lot of effort. If we keep the same old jdk, can someone tell me if use of Date and Calendar api will be impacted by the Daylight saving change.....provided the timezone is default and not explicitly set to EST. Also there isnt any timezone related buss logic.

  • BO-XI R2 daylight saving time

    The time in infoview has not changed to accommodate the daylight saving time change.
    Version:  11.5.8.8265
    Tried to install xir2 edst patch (CHF15_DST), when doing so I get a message stating "MHF1 is needed as prerequisite"...when I try to install MHF1, receive message "No supported XIR2 products detected"
    Please advice, thank you.

    Symptom
    The Integration Kit for Baan driver displays incorrect time data in reports. The time is off by an hour between the dates marking the old Daylight Saving Time (DST) and the new DST change.
    Cause
    DST has been changed to occur earlier in the year. The Integration Kit for Baan does not pick the new settings up.
    Resolution
    There are files called ZONEFILES on the BAAN Server. These files must be already updated on the Baan server side.
    The Integration Kit for Baan installs our own version of these files in the following folder:
    \Baan\Native\lib\ZONEINFO
    on the hard drive where the Integration Kit is installed.
    Back up these files on the Crystal Reports/Business Objects XI computer, then put a copy of the ZONEFILES from the Baan Server to the computer where the Integration Kit for Baan is installed.

Maybe you are looking for

  • Why is the output file jerky ?

    Hi there, I have AE CS5 on my Mac. My system is 27" iMac core i5 with 12 GB RAM DDR3 1333 MHz with quad core. I rendered a 40 seconds clip with an earth spinning. I output it to mov format in 1920 x 1080. When I did a RAM preview, it was fine & the e

  • Why is the font different weight in iOS?

    I am using an iOS font and yet it's thin and badly rendered until I edit the text field and then it appears bolder than it should appear. I've been using Helvetica Neue and it looks thin on my iPad and the line size is shorter than what I have set. A

  • My iPhone 4 shut off and will not come back on. How do I fix it?

    My iPhone 4 has not had any problems before and all the sudden froze then the scream slowly started fading away into black. Amd now will not turn back on at all.

  • How to add % symbol to a KF calculation in Bex

    Hi I am using my own formula for % Calculation in a Bex Formula (Not using an standard % functions)....Is there any way that i can insert % symbol to the result displayed in the report Thanks

  • Training Coordinator for Org Unit

    Hi How can we assign training coordinator to Org unit ?? Regards Ammad