getDayOfYear
Table of Contents
Overview
The getDayOfYear function takes a dateTimeValue as an argument, and returns a number representing the day of the year on which the specified dateTimeValue falls. The values range from 1 through 365 for normal years and 1 through 366 for leap years.
Return Type
- Number
Syntax
<variable> = <dateTimeValue>.getDayOfYear();
where,
Parameter | Description | Data type |
---|---|---|
<variable> | Variable which will contain the returned number of the day in the year. | NUMBER |
<dateTimeValue> | The date-time value based on which a number will be returned. The date-time value can be specified without a time value, in which case 00:00:00 will be taken as the default time value. A runtime error will be encountered if:
The function returns a null value if:
Refer this help document to learn about the supported date-time formats. | DATE-TIME |
Examples
currentDate = '31-Dec-2020';
dayNumber = currentDate.getDayOfYear(); // returns 366
dayNumber = currentDate.getDayOfYear(); // returns 366