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: DATEFNS 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:

DATEFNS Setting

I6 or I7 Format

I8 Format or Greater

ON

YYNNN

YYYYNNN

OFF

YYNNN

YYNNN

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

WebFOCUS

Feedback