Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Day Light Savings - datediff/dateadd

Status
Not open for further replies.

alarge23

Programmer
Oct 26, 2003
50
US
I recently upgraded our Coldfusion MX6.1 to JVM 1.4.2_11 in order to support the 2007 day light savings rules. If I run the following calculation I would expect to get 24 hours, but instead get 23 hours. Is this correct?

<cfset datetime1 = #CreateDateTime(2007,3,10,15,0,0)#>
<cfset datetime2 = #CreateDateTime(2007,3,11,15,0,0)#>
<cfset Diff = #datediff('H',datetime1,datetime2)#>
#Diff# <!--- returns 23 hours, not 24 --->
 
I am not too familiar with JVM 1.4.2-b28 is that more recent than 1.4.2_11?
If not, than your JVM still thinks day light savings is the first Sunday in April. This no longer true. Begining this year Day Light savings is now the 2nd Sunday in March. According to Adobe, JVM 1.4.2_11 and higher supports this new Day Light Savings rule.

What do you get for this bit of code? Mine returns 25, since this was the "fall back" date last year.

<cfset datetime1 = #CreateDateTime(2006,10,28,15,0,0)#>
<cfset datetime2 = #CreateDateTime(2006,10,29,15,0,0)#>
<cfset Diff = #datediff('H',datetime1,datetime2)#>
#Diff#

 
Begining this year Day Light savings is now the 2nd Sunday in March.

Would 23 not be right then? If the clocks change, there would be only 23 hours of a difference, not 24.

Or am I missing something obvious?

Hope this helps

Wullie

YetiHost - Quality Coldfusion 7/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Maybe, and that is my original question. However, if you run the queries below in SQL Server (version 2000) you get 24 hour difference.

SELECT DATEDIFF(hh,'2006-10-28 15:00:00.000','2006-10-29 15:00:00.000') AS difference
SELECT DATEDIFF(hh,'2007-03-10 15:00:00.000','2007-03-11 15:00:00.000') AS difference

This is testing the last time change (in October) and the next one in March. Both functions return 24 hours. Coldfusion returns 25 hours for the October test and 23 hours for the March test.

Is the Coldfusion datediff function meant to work that way?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top