The date and time utilities are:
%D: Displays the current date using the [d]d-mmm-[yy]yy format.
%DATE: Converts input date to the $HOROLOG format.
%H: Converts date and time to and from $HOROLOG format.
%T: Displays the current time in [h]h:mm AM/PM format.
%TI: Converts time to $HOROLOG format.
%TO: Converts the current time from $HOROLOG format to [h]h:mm AM/PM format.
The "%" sign has been removed from the topic headings below, intentionally.
$ZDATEFORM |
INTERPRETATION OF 2 DIGIT YEAR |
OUTPUT OF %D |
0: |
20th century (1900 - 1999) |
2 digits |
1: |
current century (2000 - 2099) |
4 digits |
(1841-9999): |
the next 99 years starting from $ZDATEFORM (x - x+99) |
4 digits |
other: |
current century (2000 - 2099) |
4 digits |
INT: Sets variable %DAT to current date.
FUNC[()]: Invokes an extrinsic function returning today's date.
INT: Converts %DS input non-interactively, if defined, otherwise the current date.
FUNC(t): Invokes an extrinsic function returning $HOROLOG format of the argument.
%DATE Input Formats | ||
ELEMENT |
DESCRIPTION |
EXAMPLES |
DAYS |
1 or 2 digits |
1,01,24 |
MONTHS |
1 or 2 digits |
3,03,12 |
|
Abbreviations accepted |
MAR |
|
Numeric months precede days |
1/5 is 5 Jan |
|
Alpha months may precede or follow days |
3 MAR MAR 3 |
YEARS |
2 or 4 digits |
11/22/98 11/22/2002 |
|
A missing year defaults to current year |
11/22 |
TODAY |
Abbreviation accepted |
T[ODAY] |
|
t+/- N. no. of days |
t+1 t-3 |
TOMORROW |
Abbreviation accepted |
TOM[ORROW] |
YESTERDAY |
Abbreviation accepted |
Y[ESTERDAY] |
NULL INPUT |
Defaults to today |
|
DELIMITERS |
All non-alphanumeric character(s) except the + or - offset |
11/22/98 11 Nov 98 22 Nov, 2002 11-22-2002 |
GTM>DO ^%DATE Date: GTM>ZWRITE %DN=62047
GTM>DO INT^%DATE GTM>ZWRITE %DN=59105
GTM>SET %DS="10/20/2010" GTM>DO INT^%DATE GTM>ZWRITE %DN=62019 %DS="10/20/2010"
GTM>WRITE $$FUNC^%DATE("10/20/2010") 62010
GTM>WRITE $ZDATEFORM 1975 GTM>WRITE $$FUNC^%DATE("10/20/80") 51062 GTM>WRITE $ZDATE(51062) 10/20/1980 GTM>WRITE $$FUNC^%DATE("10/20/10") 62019 GTM>WRITE $ZDATE(62019) 10/20/2010
The %H utility converts date and time to and from $HOROLOG format.
%CDS: Converts %DT $HOROLOG input date to mm/dd/yyyy format.
%CTS: Converts %TM $HOROLOG input time to external format.
%CDN: Converts %DT input date to $HOROLOG format.
%CTN: Converts %TM input time to $HOROLOG format.
CDS(dt): Extrinsic entry that converts the $HOROLOG argument to external date format.
CTS(tm): Extrinsic entry that converts the $HOROLOG argument to external time format.
CDN(dt): Extrinsic entry that converts the argument to $HOROLOG format.
CTN(tm): Extrinsic entry that converts the argument to $HOROLOG format.
GTM>SET %DT=+$H DO %CDS^%H GTM>ZWRITE %DAT="10/20/2010" %DT=62047
GTM>SET %DT="10/20/2002" DO %CDN^%H GTM>ZWRITE %DAT=59097 %DT="10/20/2002"
GTM>SET %TM=$P($H,",",2) DO %CTS^%H GTM>ZWRITE %TIM="17:41:18" %TM=63678
GTM>SET %TM="17:41:18" DO %CTN^%H GTM>ZWRITE %TIM=63678 %TM="17:41:18"
GTM>WRITE $$CDS^%H(62019) 11/17/2010
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
INT: Sets %TIM to current time in [h]h:mm AM/PM format.
FUNC[()]: Invokes an extrinsic function returning the current time.
The following table summarizes input formats accepted by %TI.
%TI Input Formats | ||
ELEMENT |
DESCRIPTION |
EXAMPLES |
HOURS |
1 or 2 digits |
3,03,12 |
MINUTES |
2 digits |
05,36 |
AM or PM |
AM or PM required |
9:00 AM or am 9:00 PM or pm |
|
Abbreviation accepted |
9:00 A or a 9:00 P or p |
NOON |
Abbreviation accepted |
N[OON] |
MIDNIGHT or MIDNITE |
Abbreviation accepted |
M[IDNIGHT] or m[idnight] M[IDNITE] or m[idnite] |
MILITARY |
No punctuation (hhmm) |
1900, 0830 |
NULL INPUT |
Defaults to current time |
|
DELIMITERS |
Colon between hours and minutes |
3:00 |