DAY_OF_YEAR

Use the DAY_OF_YEAR script function to return the day of the year for a given date.

Syntax

DAY_OF_YEAR ([DateFormat:]Date)

Parameters

Parameter Description Format
DateFormat

(Optional) Specifies the format of the date.

Note: Use this parameter if the date that you specify is not in YYMMDD or YYYYMMDD format. Separate the date format and the date with a colon or semicolon. For more information, see Date, Time and Period Formats in Scripts.

Script literal or script variable
Date Defines the date in YYMMDD or YYYYMMDD format. Script literal or script variable

Return Codes

The DAY_OF_YEAR function returns the day of the year as a numeric value string.

Examples

In the following example, the specified date is in a different format than YYMMDD or YYYYMMDD, so the script specifies the date format.

: SET &DAYNUMBER# = DAY_OF_YEAR ("DD.MM.YY:31.12.00")

: PRINT &DAYNUMBER#

2000 was a leap year, so December 31 is the 366th day of that year:

2019-03-28 11:40:09 - U00020408 366

In the following example, the specified date is in YYMMDD format, so the script does not need to specify the current format.

: SET &DAYNUMBER# = DAY_OF_YEAR ("190402")

: PRINT &DAYNUMBER#

April 2 is the 92nd day of the year in 2019:

2019-03-28 11:43:51 - U00020408 092

See also: