Command Reference : Function Reference : Function Reference: U
  
 
@utc
 
Convert local time to UTC (Coordinated Universal Time).
Syntax: @utc(localtime[, timezone])
localtime: date number, series, vector
timezone: (optional) string, alpha, svector
Return: date number, series, vector
Returns the Coordinated Universal Time (UTC) value for a point in time input using a local time zone value.
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
@utc(dtime, "-08:00")
convert local time at an 8 hour shift from UTC into UTC times.
If LOCALTIME is a series of local time values,
series utctime = @utc(localtime, "-05:00")
converts a series containing local time values at a 5 hour shift from UTC into a series containing UTC times, for observations in the workfile sample.
series utctime = @utc(localtime, "Pacific")
converts a series containing local time values in U.S. Pacific Time Zone (including daylight time adjustments) into a series containing UTC, for observations in the workfile sample.
if VLOCALTIME is a vector of time values,
vector vutctime = @utc(vlocaltime, "Stockholm")
converts the vector of local times in Stockholm, into UTC times.
Cross-references
See “Dates” and “Event Functions” for related discussion.
See also the related time zone functions @localt, @tz, @tzlist and @tzspec.