Solved

Coldfusion MX and Daylight Savings

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now