Example:
GTM>SET %DT=+$H DO %CDS^%H GTM>ZWRITE %DAT="10/20/2002" %DT=59097
This example sets %DT to the current date in $HOROLOG format and converts it to mm/dd/yyyy format by invoking %H at the label %CDS. %H returns the converted date in the variable %DAT. ZWRITE displays the contents of the variables.
Example:
GTM>SET %DT="10/20/2002" DO %CDN^%H GTM>ZWRITE %DAT=59097 %DT="10/20/2002"
This example sets the variable %DT to a date in mm/dd/yyyy format and invokes %H at the label %CDN. %H returns the converted date in the variable %DAT. ZWRITE displays the contents of the variables.
Example:
GTM>SET %TM=$P($H,",",2) DO %CTS^%H GTM>ZWRITE %TIM="17:41:18" %TM=63678
This example sets the variable %TM to the current time in $HOROLOG format using a $PIECE() function to return only those digits of the $HOROLOG string that represent the time. The example then invokes %H at the label %CTS. %H returns the converted time in the variable %TIM. ZWRITE displays the contents of the variables.
Example:
GTM>SET %TM="17:41:18" DO %CTN^%H GTM>ZWRITE %TIM=63678 %TM="17:41:18"
This example sets the variable %TM to a time in hh:mm:ss format, and invokes %H at the label %CTN. %H returns the converted time in the variable %TIM. ZWRITE displays the contents of the variables.
Example:
GTM>WRITE $$CDS^%H(59130) 11/22/2002
This invokes CDS^%H as an extrinsic function to convert the external argument to external date format.
Example:
GTM>WRITE $ZDATEFORM 1980 GTM>WRITE $$CDN^%H("10/20/02") 59097 GTM>WRITE $ZDATE(59097) 10/20/2002 GTM>WRITE $$CDN^%H("10/20/92") 55445 GTM>WRITE $ZDATE(55445) 10/20/1992
This example shows the use of a year limit in $ZDATEFORM. Two digit years are interpreted to be in the interval of 1980 - 2079; since $ZDATEFORM is 1980, the input year "02" is interpreted as "2002" and "92" is interpreted as "1992". This example invokes CDN^%H to convert the argument in mm/dd/yy format to $HOROLOG format. $ZDATE() is used to conver the $HOROLOG format date to mm/dd/yyyy format.