Solved

Coldfusion MX and Daylight Savings

Posted on 2008-06-23
4
445 Views
Last Modified: 2012-06-27
I am running Coldfusion MX 7.0.2 on a fully patched Windows 2003 server.  I am running Java Version
1.4.2_11-b06 on the server.  I am querying data from an Oracle database.  If I view the Oracle data in something like Access the times are displayed correctly because Office doesn't account for DST.  Basically I have a value that is read every hour so each day has 24 readings.  My problem is that readings between November 4, 2007 and March 9, 2008 all are offset by 1 hour which messes up my data.  I've installed al the DST patches for Java and Coldfusion but it doesn't seem to help.  I also tried using <cfif> statements to evaluate the dates like <cfif newdate GT 11042007 LT 03092008> but no matter how I format or convert the dates it will not evaluate them and this portion of my code is basically skipped.  What I need is actually simple.  I want Coldfusion to completely ignore DST.  I just want it to read the database and return exactly what is there with no conversion but even if I do a to_char it still apparently applies DST before the conversion.  How can I disable DST changes altogether or is there something else I can do to fix this problem?

To get my data I am using the following SQL statement.
WHERE read_time BETWEEN TO_DATE ('#readtime# 00', 'yyyy/mm/dd hh24') AND TO_DATE ('#readtime# 23', 'yyyy/mm/dd hh24')
This gives me the correct data for today for example but anything in the range I listed above is off by an hour.  

0
Comment
Question by:KCody
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 21849135
you can check to make sure that cf is actually -using- the correct jvm as multiples can be installed

run this bit

<cfset sys=CreateObject("java","java.lang.System")>
<cfoutput>
<p>You are running
   <strong>#sys.getProperty("java.vendor")#</strong>
   jvm version
   <strong>#sys.getProperty("java.version")#</strong>.
</p>
<hr />
</cfoutput>

afaik there's no way to -ignore- the dst patch (and I really can't imagine a reason why you'd want to)
0
 

Author Comment

by:KCody
ID: 21849330
Here is the result I get when I run your code:
You are running Sun Microsystems Inc. jvm version 1.4.2_11.

DST is working properly, I guess what I need to know is how do I evaluate dates that fall within the DST range and add an hour to them so they will report correctly?
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 21849483
just use dateadd example using a temp query object

<cfset TempQry= querynew("")>
 <cfset queryaddcolumn  (TempQry, "Col1", "CF_SQL_integer", ListToArray("1,2,3"))>
<cfset queryaddcolumn  (TempQry, "Col2", "cf_sql_date", ListToArray("06/01/2008 12:00, 02/01/2008 12:00, 12/20/2007 12:00"))>
 
<cfloop query="tempqry">
<cfset d1 = dateadd("h",1,col2)>
<cfoutput>
#col2#: #d1#<br></cfoutput>
</cfloop>

and using between so only the 2 early dates are affected

<cfset TempQry= querynew("")>
 
<cfset queryaddcolumn  (TempQry, "Col1", "CF_SQL_integer", ListToArray("1,2,3"))>
<cfset queryaddcolumn  (TempQry, "Col2", "cf_sql_date", ListToArray("06/01/2008 12:00, 02/01/2008 12:00, 12/20/2007 12:00"))>
 <cfquery name="q2" dbtype="query">
select * from tempqry where col2 between '11/04/2007' and '03/09/2008'
</cfquery>
<cfloop query="q2">
<cfset d1 = dateadd("h",1,col2)>
<cfoutput>
#col2#: #d1#<br></cfoutput>
</cfloop>

0
 

Accepted Solution

by:
KCody earned 0 total points
ID: 21858640
What you wrote may work but I can't get it to work with my application.  If I could see an easy example of evaluating date values from an Oracle source it would really help me out.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question