Handling Daylight Savings Time in ColdFusion

SportsFilter has been misreporting the time on posts and comments since the U.S. sprang forward, reporting times in CST instead of CDT.

To fix the problem, I wrote a few lines of ColdFusion code to set a tzid variable to the proper timezone identifier:

<cfset tzinfo = GetTimeZoneInfo()>
<cfset tzid = "CST">
<cfif tzinfo.isDSTOn IS "True">
  <cfset tzid = "CDT">
</cfif>

Comments

Thank you!

Add a Comment

These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. A comment may not include more than three links. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).