GetTimeZoneInfo

Description

Gets local time zone information for the computer on which it is called, relative to Universal Time Coordinated (UTC). UTC is the mean solar time of the meridian of Greenwich, England, used as the basis for calculating standard time throughout the world.

ColdFusion stores date and time values as date-time objects: real numbers on a universal time line. It converts an object to a time zone when it formats an object; it converts a date/time value from a time zone to a real number when it parses a value.

Returns

Structure that contains these elements and keys:

  • utcTotalOffset: offset of local time, in seconds, from UTC

    • A plus sign indicates a time zone west of UTC (such as a zone in North America)

    • A minus sign indicates a time zone east of UTC (such as a zone in Germany)

  • utcHourOffset: offset, in hours of local time, from UTC

  • utcMinuteOffset: offset, in minutes, beyond the hours offset. For North America, this is 0. For countries that are not exactly on the hour offset, the number is from 0 through 60. For example, standard time in Adelaide, Australia is offset 9 hours and 30 minutes from UTC.

  • isDSTOn: True, if Daylight Savings Time (DST) is on in the host; False, otherwise

Function syntax

GetTimeZoneInfo()

Example

<h3>GetTimeZoneInfo Example</h3> 
<!--- 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>