DaysAfter
PowerScript function
Description
Determines the number of days one date occurs after another.
Syntax
|
1 |
DaysAfter ( date1, date2 ) |
|
Argument |
Description |
|---|---|
|
date1 |
A date value that is the start date of the interval being |
|
date2 |
A date value that is the end date of the interval |
Return value
Long.
Returns a long whose value is the number of days date2 occurs after
date1. If date2 occurs before date1, DaysAfter returns a negative number.
If any argument’s value is null, DaysAfter returns null.
Examples
This statement returns 4:
|
1 |
DaysAfter(2002-12-20, 2002-12-24) |
This statement returns -4:
|
1 |
DaysAfter(2002-12-24, 2002-12-20) |
This statement returns 0:
|
1 |
DaysAfter(2003-12-24, 2003-12-24) |
This statement returns 5:
|
1 |
DaysAfter(2003-12-29, 2004-01-03) |
If you declare date1 and date2 date variables and assign February
16, 2003, to date1 and April 28, 2003, to date2 as follows:
|
1 2 3 |
date date1, date2 date1 = 2003-02-16 date2 = 2003-04-28 |
then each of the following statements returns 71:
|
1 2 3 4 |
DaysAfter(date1, date2) DaysAfter(2003-02-16, date2) DaysAfter(date1, 2003-04-28) DaysAfter(2003-02-16, 2003-04-28) |
See also
DaysAfter method for DataWindows in the section called “DaysAfter” in DataWindow Reference.