Convert UTC (Coordinated Universal Time) to local time.
Syntax: @localt(utctime[, timezone])
utctime: date number
timezone: (optional) timezone string
Return: date number
Returns the local time zone representation of a point in time input in Coordinated Universal Time (UTC), utctime.
• If timezone is not provided, the current Windows time zone setting is used as the local time zone target.
• If
timezone is provided, the timezone string can either contain raw time zone information in the format returned by
@tzspec or it can contain search text (such as a city name) found within one of the time zone descriptions returned by the function
@tzlist.
Examples
The commands
scalar dtime = @now
string london_spec = @tzspec("London")
@localtime(dtime, "+00:00 +01:00 Mar-1Sun 1:00 to Oct-1Sun 2:00")
@localtime(dtime, london_spec)
@localtime(dtime, "London")
give the date number for current London time. The first instance of @localtime uses the raw string for the London timezone string.
If UTC1 is a series containing UTC time values,
series tokyo_time = @localt(utc1, "Tokyo")
converts the values into equivalent local time values in Tokyo, for all observations in the workfile sample.
If UTC2 is a vector containing time values,
vector madrid_time = @localtime(utc2, "Madrid")
converts all date numbers in UTC2 into local Madrid time.
Additionally, if LOCSTR is a string vector containing timezone information
vector local_time = @localtime(@now, locstr)
converts the current time date number into the local time specified in the elements of LOCSTR.
Cross-references
See
“Dates” and
“Event Functions” for related discussion.
See also the related time zone functions
@utc,
@tz,
@tzlist, and
@tzspec.