Solved

Coldfusion MX and Daylight Savings

Posted on 2008-06-23
4
433 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

763 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