Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 12
Working With Julian Day Numbers
TIME1 := JULIANTIMESTAMP(SINCE^COLD^LOAD);
.
.
TIME2 := JULIANTIMESTAMP(SINCE^COLD^LOAD);
INTERVAL := TIME2 - TIME1;
DAYS := INTERPRETINTERVAL(INTERVAL,HOURS,
MINUTES,SECONDS,
MILLISECS,MICROSECS);
Working With Julian Day Numbers
For operations that require the date but not necessarily the time of day, you can
measure time using Julian day numbers. A Julian day number is the number of days
since January 1, 4713 B.C.
You can use system procedures to perform the following operations on Julian day
numbers:
Obtain the Julian day number from a Julian timestamp (INTERPRETTIMESTAMP
procedure)
Convert Julian day numbers into Gregorian dates (INTERPRETJULIANDAYNO
procedure)
Compute the Julian day number from a Gregorian date
(COMPUTEJULIANDAYNO procedure)
Determine the day of the week that corresponds to a Julian day number
(DAYOFWEEK procedure)
The following paragraphs describe how to perform these operations.
Obtaining the Julian Day Number
You use the INTERPRETTIMESTAMP procedure to establish the Julian day number.
You have already seen how this procedure converts a Julian timestamp into a
Gregorian date and time. Here, however, you will examine the return value that
contains the Julian timestamp. For example:
JULIAN^TIMESTAMP := JULIANTIMESTAMP(CURRENT^GMT);
JULIAN^DAY^NUMBER := INTERPRETTIMESTAMP(JULIAN^TIMESTAMP,
DATE^AND^TIME);