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.
<cfset jtzobj = createObject("java","java.util.TimeZone")>
<cfset timezone = jtzobj.getTimeZone(jtzobj.getDefault().ID)>
<cfif timezone.inDaylightTime(datetime)>
<cfoutput>#Dateformat(datetime)#</cfoutput> is daylight savings time
<cfelse>
<cfoutput>#Dateformat(datetime)#</cfoutput> is standard time
</cfif>
<cfset timezone = jtzobj.getTimeZone(jtzobj.getDefault().ID)>
<cfif timezone.inDaylightTime(datetime)>
<cfoutput>#Dateformat(datetime)#</cfoutput> is daylight savings time
<cfelse>
<cfoutput>#Dateformat(datetime)#</cfoutput> is standard time
</cfif>
There are no comments for this entry.
[Add Comment]