JULDAT: Converting From Gregorian to Julian Format

How to:

Reference:

Available Languages: reporting, Maintain

The JULDAT function converts a date from Gregorian format (year-month-day) to Julian format (year-day). A date in Julian format is a five- or seven-digit number. The first two or four digits are the year; the last three digits are the number of the day, counting from January 1. For example, January 1, 1999 in Julian format is either 99001 or 1999001.

Reference: Format Settings for JULDAT

JULDAT converts a Gregorian date to either YYNNN or YYYYNNN format, using the DEFCENT and YRTHRESH parameter settings to determine if the century is required.

JULDAT returns dates as follows:

  • If the format is I6, JULDAT returns the date in YYNNN format.
  • If the format is I7 or greater, JULDAT returns the date in YYYYNNN format.

Syntax: How to Convert From Gregorian to Julian Format

JULDAT(indate, output)

where:

indate

I6, I8, I6YMD, I8YYMD

Is the legacy date to convert or the name of the field that contains the date in year-month-day format (YMD or YYMD).

output

I5 or I7

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

Example: Converting From Gregorian to Julian Format

JULDAT converts the HIRE_DATE field to Julian format. It determines the century using the default DEFCENT and YRTHRESH parameter settings.

TABLE FILE EMPLOYEE
PRINT HIRE_DATE AND COMPUTE
JULIAN/I7 = JULDAT(HIRE_DATE, JULIAN);
BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'PRODUCTION';
END

The output is:

LAST_NAME     FIRST_NAME  HIRE_DATE   JULIAN
---------     ----------  ---------   ------
BANNING       JOHN         82/08/01  1982213
IRVING        JOAN         82/01/04  1982004
MCKNIGHT      ROGER        82/02/02  1982033
ROMANS        ANTHONY      82/07/01  1982182
SMITH         RICHARD      82/01/04  1982004
STEVENS       ALFRED       80/06/02  1980154