getTimezoneInfo

Gets time zone information for the server, relative to UTC: utcTotalOffset, utcHourOffset, utcMinuteOffset, isDSTOn and timezone. CF 2025+ also returns DSTOffset, name, nameDST, shortName and shortNameDST, and can describe any timezone.

getTimezoneInfo(text) → returns any

Argument Reference

timezone string

CF 2025+ The timezone to return info for, such as US/Eastern. Defaults to the server timezone.

locale string

CF 2025+ The locale used to format the timezone names, such as en_US. Defaults to the server locale.

Examples
Sample code invoking the getTimezoneInfo function

This example shows the use of GetTimeZoneInfo

<cfoutput>
The local date and time are #now()#.
</cfoutput>
<cfset info = GetTimeZoneInfo()>
<cfoutput>
<p>Total offset in seconds is #info.utcTotalOffset#.</p>
<p>Offset in hours is #info.utcHourOffset#.</p>
<p>Offset in minutes minus the offset in hours is #info.utcMinuteOffset#.</p>
<p>Is Daylight Savings Time in effect? #info.isDSTOn#.</p>
</cfoutput>

Shows the use of getTimeZoneInfo for a known / specific timezone with German locale. This syntax is only supported in Lucee.

<cfscript>
var tz = getTimeZoneInfo("US/Hawaii", "de-DE");
</cfscript>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub