Name
GetTimeZoneInfo
Synopsis
GetTimeZoneInfo( )
Returns a structure containing time-zone information for the host
server calling the function. The following structure keys are
returned by calling GetTimeZoneInfo( )
:
-
UTCTotalOffset
Returns the local offset time in minutes from Universal Coordinated Time (UTC). UTC is coordinated on the prime meridian (running through Greenwich, U.K.). Positive offset values represent time zones west of the prime meridian, while negative offsets represent time zones east of the prime meridian.
-
UTCHourOffset
Returns the local offset time from UTC in hours.
-
UTCMinuteOffset
Returns the local offset time in minutes after
UTCHourOffset
is applied. The value forUTCHourOffset
can range from 0 to 60 depending on where a particular time zone falls in relation to the nearest hour offset. All North American time zones return 0 forUTCMinuteOffset
.-
IsDSTOn
Returns
true
if daylight savings time (DST) is turned on for the host machine andfalse
if it isn’t.
Example:
<cfset MyTimeZoneInfo = GetTimeZoneInfo( )> <cfoutput> Local time is offset #MyTimeZoneInfo.utcTotalOffset# minutes from UTC.<br> Local time is offset #MyTimeZoneInfo.utcHourOffset# hours and #MyTimeZoneInfo.utcMinuteOffset# minutes from UTC.<br> Daylight Saving Time is <cfif #MyTimeZoneInfo.isDSTOn#><b>on</b> <cfelse><b>off</b></cfif> for the host. </cfoutput>
Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.