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

Category

Date and time functionsInternational functions

Function syntax

GetTimeZoneInfo()

See also

DateConvertCreateDateTimeDatePart

Example

 <cfscript>
     curdatetime = now();
     writeOutput("The local date and time are " & curdatetime & "<br/>");
     info = GetTimeZoneInfo();
     writeOutput("Total offset in seconds is " & info.utcTotalOffset & "<br/>");
     writeOutput("Offset in hours is " & info.utcHourOffset & "<br/>");
     writeOutput("Total offset in minutes minus is " & info.utcMinuteOffset & "<br/>");
     writeOutput("Total offset in seconds is " & info.isDSTOn & "<br/>");
 </cfscript>

Output

The local date and time are {ts '2018-11-06 05:18:27'}
Total offset in seconds is 0
Offset in hours is 0
Total offset in minutes minus is 0
Total offset in seconds is NO

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy