11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Caché</strong> <strong>ObjectScript</strong> Special VariablesNote:Exercise caution when comparing local time and UTC time:• The preferred way to convert UTC time to local time is to use the $ZUTIL(193)function, supplying your local time zone offset in minutes. This function adjustsfor local time variants.• You cannot interconvert local time and UTC time by simply adding or subtractingthe value of $ZTIMEZONE * 60. This is because, in many cases, local time isadjusted for local time variants (such as Daylight Savings Time, which seasonallyadjusts local time by one hour). These local time variants are not reflected in$ZTIMEZONE.• Both the timezone offset from UTC and local time variants (such as the seasonalshift to Daylight Savings Time) can affect the date as well as the time. Convertingfrom local time to UTC time (or vice versa) may change the date as well as thetime.This special variable cannot be modified using the SET command. Attempting to do so resultsin a error.Note: $ZTIMESTAMP cannot be used on OpenVMS systems prior to Release 7.0.Invoking $ZTIMESTAMP on a VMS 6.x system generates an error.Coordinated Universal Time ConversionsYou can represent local time information as Coordinated Universal Time (UTC) using the$ZDATETIME and $ZDATETIMEH functions with tformat values 7 or 8, as shown in thefollowing example:WRITE !,$ZDATETIME($ZTIMESTAMP,1,1,2)WRITE !,$ZDATETIME($HOROLOG,1,7,2)WRITE !,$ZDATETIME($HOROLOG,1,8,2)WRITE !,$ZDATETIME($ZUTIL(188),1,7,2)WRITE !,$ZDATETIME($ZUTIL(188),1,8,2)The above $ZDATETIME functions all return the current time as Coordinated UniversalTime (rather than local time). The conversions from local time adjust for local time variantsand adjust the date accordingly, if necessary. However, the $ZTIMESTAMP display valueand the tformat 7 or 8 converted display values are not identical. The tformat values 7 and 8insert the letter “T” before, and the letter “Z” after the time value. Also, because $HOROLOGtime does not contain fractional seconds, the precision of 2 in the above example pads thosedecimal digits with zeros.490 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!