Built-In Functions - 3

537 Views


Date Details

The *DATE DETAILS built-in function returns information about a given date; for example, day of week, length of month, or whether it is in a leap year. You specify the kind of information you need using the *Date detail type parameter.

Note that you should check the return code set by this function in order to catch any errors encountered.

There are seven parameters for this function type:

· Six input parameters

     ° *Date is the date for which information is to be returned. A field of type NBR is interpreted as the number of days since January 1, 1801 (day one). 

     ° *Date detail type specifies the kind of information to be returned for the *Date field. See the table at the end of this topic.

      ° *Excluded days of week specifies days that are normally to be excluded from the operation; for example, weekends.

      ° *Date List name specifies the name of an existing date list. Date lists let you override selection rules set by the *Excluded days of week parameter for particular dates; for example, holidays. The specified date list needs to be in the *Date Lists array when the built-in function executes.   

    ° *Date List autoload specifies whether the function will automatically load the date list into the *Date Lists array when it executes.

    ° *Select days/dates lets you reverse the selection determined by the *Excluded days of week and *Date List name parameters. The default is to provide date details for included days only.

· One output parameter, *Date detail. This field contains the requested information for the input date. Its meaning is determined by the *Date Detail Type.

The possible values for the *Date detail type and the effect of each on the meaning of the output field are summarized in the following table:

The result in *Date detail reflects only selected days unless you specify *ABSOLUTE DAY, *MONTH, *YEAR, or *LEAP YEAR for *Detail type.

Example Suppose you want to calculate the day of the week an order was placed. For example, if the order date was, August 4, 1994, the result will be Thursday. Following are parameter specifications for the *DATE DETAILS built-in function that will produce this result. Scroll to view the *Selected days/dates parameter.

Selection Parameters for Date Built-In Functions

This topic gives details about the selection parameters for the *DATE DETAILS, *DATE INCREMENT, and *DURATION built-in functions. It also discusses the related *Date list autoload parameter.

The selection parameters are · *Excluded days of week · *Date List name · *Select days/dates

*Excluded Days Of Week
This parameter is a condition field or derived field of type STS. Use this parameter to specify days that are normally to be excluded from an operation; for example, weekends or days not worked by part-time employees.

Each value you specify for this parameter consists of seven digits.

Each digit may be 1 or 0 and corresponds to a day of the week beginning with Monday. A 1 indicates that the day is to be included in the operation; a 0 indicates that the day is to be excluded.

The possible values are shown in the following table.

You can modify the selection rule set by this parameter using the other two selection parameters. · Use *Date List name to exclude or include particular dates. · Specify *EXCLUDE for *Select days/dates to reverse the effect of the selection; in other words, to select excluded days.

*Date List Name

This parameter specifies the name of an existing date list.

Date lists let you override the selection rules set by the *Excluded days of week parameter for particular dates; for example, holidays. A date list consists of a unique name, a list of dates, and a 1 or 0 for each date to indicate whether to include or exclude the date. To use a date list, specify its name on the *Date List name parameter.

The default for *Date List name is NONE; in other words, no date list is specified. This value is required in the following cases.

· The *Duration type parameter is other than *DAYS on the *DATE INCREMENT and *DURATION built-in functions.

· The *Date detail type parameter is *ABSOLUTE DAY, *MONTH, *YEAR, or *LEAP YEAR on the *DATE DETAILS built-in function.

*Select Days/Dates

This parameter lets you reverse the selection set by the *Excluded days of week and *Date List name parameters.

Normally, only included days are selected and considered by a date built-in function. This parameter lets you select excluded days instead.

The possible values for this parameter are shown in the following table.

Post Comments