Solved

Coldfusion MX and Daylight Savings

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

832 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