How to ensure correct UTC Time Conversion for U.S. Daylight Saving Time changes in 2007 (ColdFusion 5)
Issue
ColdFusion 5 depends on the operating system to calculate date and time information. The U.S. Daylight Savings Time changes for 2007 will cause incorrect Universal Time Coordinated (UTC) conversions with ColdFusion 5.
Note: Support for ColdFusion 5 officially ended on January 1, 2007 -- see www.adobe.com/support/programs/coldfusionent/?tab:contact=1#cf5policy for more details.
Reason
The U.S. Energy Policy Act of 2005 extended the daylight savings time (DST) for the U.S. an extra four weeks. Starting in 2007, the DST in the U.S. will begin at 2:00 A.M. on the second Sunday in March (03/11/2007), and end on 2:00 A.M. on the first Sunday in November (11/04/2007). To compensate for the change, operating system vendors have released patches to update the internal DST information. ColdFusion 5.0 continues to use the original DST information on patched systems, and will miscompute local time to UTC (Local2UTC) and UTC to local time (UTC2Local) conversion made with the dateConvert function during daylight savings time. All other ColdFusion 5.0 date and time functions will use the updated DST information and perform the appropriate date and time evaluations correctly.
Note: The ColdFusion MX (all versions) dateConvert function behaves correctly with the Sun Java Virtual Machine (JVM) version 1.4.2_11 or higher. For further details, see TechNote d2ab4470.
Solution
Apply the appropriate operating system patch to install the updated DST information. Consult your operating system vendor for more information on installing their patches. Here are some links to information on the 2007 U.S. Daylight Savings Time change for operating system vendors supported by ColdFusion 5:
- Microsoft Windows XP and 2003: http://support.microsoft.com/kb/928388
- Sun Solaris (account required): http://sunsolve.sun.com/
- Linux:
ColdFusion 5's dateConvert function adds an hour for Local2UTC conversions and subtracts an hour for UTC2Local conversions. The workaround is to subtract an hour for Local2UTC and add an hour for UTC2Local conversion during DST. For example:
<cfscript> cfTZ = getTimeZoneInfo(); dateObj = now(); if (cfTZ.isDSTOn) { utcDate = dateAdd('h', -1, dateConvert("Local2UTC", dateObj)); localDate = dateAdd('h', 1, dateConvert("UTC2Local", dateObj)); } else { utcdate = dateConvert("Local2UTC", dateobj); localDate = dateConvert("UTC2Local", dateObj); } </cfscript>
ColdFusion 5 Additional DST Change Step
If the operating system has had the appropriate DST patches applied then, in general, ColdFusion 5 will use the time it gets from the OS. The two caveats are:
- The
DateConvert()function, resolved with the coding workaround. - The ColdFusion Server Monitoring reporting / ColdFusion Management Repository Server (CFAM) process. Only if you are utilizing this tool will you need to upgrade the JVM used by the internal version of JRun 3 that comes with ColdFusion 5. The reporting functionality is a Java based application that is dependant on the Sun JVM for it's date time functionality, which is why the JVM upgrade is needed.
To ensure that the reporting reflects the correct date/time, download the appropriate Sun JVM and edit the local.properties file for the JRun server to point to the newer JVM. The 1.3.1_18 Sun JVM has the DST fixes.
The Sun JVM 1.3.1_18 or above can be downloaded from here.
- Download and install the JVM.
- Edit the section in cf_root\jrun\servers\cfam\local.properties file and the cf_root\jrun\servers\default\local.properties file called "Path to java virtual machine. Launchers will use system PATH if necessary".
It will look similar to the following, but pathing may be different, based on OS and install directory structure of ColdFusion. Redirect the path to the equivalent section in the new JVM executable:
(Solaris)
FROM:
java.exe=/opt/coldfusion/jre/bin/sparc/native_threads/java
TO:
java.exe=/opt/j2sdk1_3_1_18/jre/bin/sparc/native_threads/java - Restart the all the ColdFusion 5 processes to pick up the JVM change.
Additional Information
- See TechNote d2ab4470 for more information on ColdFusion MX/JRun and U.S. Daylight Savings Time changes in 2007
- See TechNote tn_18310 for more information on working with daylight savings time in ColdFusion MX
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
