ColdFusion and Daylight Savings Time

ColdFusion has a large number of date functions but not one to see if a past or future date occurs when daylight savings is in effect. However it is possible to find this out using a little Java code.

view plain print about
1<cfset jtzobj = createObject("java","java.util.TimeZone")>
2    <cfset timezone = jtzobj.getTimeZone(jtzobj.getDefault().ID)>
3    <cfif timezone.inDaylightTime(datetime)>
4        <cfoutput>#Dateformat(datetime)#</cfoutput> is daylight savings time
5    <cfelse>
6        <cfoutput>#Dateformat(datetime)#</cfoutput> is standard time
7    </cfif>

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)