Date Functions
Adding / Subtracting a specified number of days to a date
Returning the year and the Julian day
Returning the day of the month
Returning the number of days between two dates
About Date Functions
You use Date Functions to convert and manipulate date expressions:
 add / subtract a specified number of days to a date
 return an integer representing the day of the week or year
 return a specified portion of a date
 return the processing date or the current date on the operating system
 calculate the number of days between two dates
The function syntax depends on the function you want to activate.
$DATEPLUS and $DATEMINUS
Description 
$DATEPLUS adds the number of days that you specify to a date. $DATEMINUS subtracts the number of days that you specify from a date. The function returns a date. The data type used in the target field must be either:

Syntax 
$DATEPLUS(date;number_of_days) $DATEMINUS(date;number_of_days) 
Return 
Date 
Parameters 
You can use any expression that returns a value except a call to the functions DATEPLUS or DATEMINUS. date
The data type used for date must be either:

number_of_days
You can use any expression except a call to the functions JULIAN or CHECK 

Example 
The following example adds five days to the specified date. $DATEPLUS(20000328; 5) returns 20000402 The following example subtracts five days from the specified date. $DATEMINUS(20000328; 5) returns 20000323 
$JULIAN
Description 
$JULIAN returns the year and the Julian day of the year for a Date expression. (1 January is equal to 1.) 
Syntax 
$JULIAN(date) 
Return 
Integer on 5 digits if the date length is 6, 6 digits if the date length is 7, 7 digits if the date length is 8 
Parameters 
You can use any expression that returns a value. date
The data type used for date must be either:

Example 
The following example uses the $JULIAN function in a mapping expression to calculate the day of the year for a given date, and converts it to an Integer. The mapped expression is written to a target field. NOTE: If the target field is numeric and contains three characters, the result of the function is only the sequence number of the day, without the value of the year.

$SYSDATE
Description 
$SYSDATE returns the current date of your operating system. If you specified a date in the AccountingIntegrator Rule Engine Script file for the DATE_OPERATION parameter, the Function returns this processing date. The target field that you define must be of the same data type as the value supplied by the $SYSDATE function. The data type used in the target field must be either:

Syntax 
$SYSDATE() 
Return 
Date (8 digits) 
Parameters 
None 
Example 
$SYSDATE() returns the current system date. 
$DAY
Description 
$DAY returns the day of the month, expressed as a twodigit numeric value, from an expression that specifies the date. 
Syntax 
$DAY(date) 
Return 
Integer on two digits 
Parameters 
date Specify a Date The data type used for date must be either:
Only BusinessDocument field or PreCalculation with length 6, 7 or 8 are authorized. The target field that you define must be compatible with Integer data type. 
Example 
The following example returns the day from the date and time expression. $DAY(FIELD1) where FIELD1 =20040323, returns 23 
$MONTH
Description 
$MONTH returns the month, expressed as a twodigit numeric value, from an expression that specifies the date. 
Syntax 
$MONTH(date) 
Return 
Integer on two digits 
Parameters 
date
The data type used for date must be either:
Only BusinessDocument field or PreCalculation with length 6, 7 or 8 are authorized. The target field that you define must be compatible with Integer data type.. 
Example 
The following example returns the month from the date and time expression. $MONTH(FIELD1) where FIELD1 =20040323, returns 03 
$YEAR and $YEAR4
Description 
$YEAR returns the year, expressed as a twodigit numeric value, from a date expression. $YEAR4 returns the year, expressed as a fourdigit numeric value from a date expression. 
Syntax 
$YEAR(date) $YEAR4(date) 
Return 
Integer on 2 digits if $YEAR or 4 digits if $YEAR4 
Parameters 
date
For the $YEAR function, the data type used for date must be either:
For the $YEAR function, only BusinessDocument field or PreCalculation with length 6, 7 or 8 are authorized. For the $YEAR4 function, only BusinessDocument field or PreCalculation with length 8 are authorized. The target field that you define must be compatible with Integer data type. 
Example 
The following example returns the year from the date and time expression. $YEAR(FIELD1) where FIELD1 =20040323, returns 04 $YEAR4(FIELD1) where FIELD1 =20040323, returns 2004 
$NBDAYS
Description 
$NBDAYS calculates the difference between two dates (without distinguishing between business and nonworking days). $NBDAYS returns a fivedigit numeric value from a date expression. The recommended target field type is N(5). 
Syntax 
$NBDAYS(start_date;end_date) 
Return 
Integer on 5 digits 
Parameters 
You can use any expression that returns a value with data type Date except a call to the Functions DATEPLUS or DATEMINUS. start_date
The data type used for start_date must be :

end_date
The data type used for end_date must be :


Example 
The following example calculates the number of days between the first date and the second date. $NBDAYS(20000328; 20000402) returns 5 