|
Calculates the difference between two dates (passed as parameters) returning the number of days, months, and years.
The result is returned in an array structure, where index 0 have the number of days, index 1 has the number of months and the index 2 have the number of years.
Parameter
|
Description |
| Date1 |
Date1 value or variable. |
| Format Date1 |
Value or Variable containing the date format stored on Date1.
|
| Date2 |
Date2 value or variable. |
| Format Date2 |
Value or Variable containing the date format stored on Date2. |
| Option |
1 = Doesn't consider the initial day; 2 = Considers the initial day. |
Ex. 1: $diferences = sc_date_dif_2 ({date1}, "yyyy-mm-dd", {date2}, "mm/dd/yyyy", 1); {dif_days} = $diferences[0]; {dif_months} = $diferences[1]; {dif_years} = $diferences[2];
Ex. 2: $diferences = sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 1); $diferences[0] = 20 (days) $diferences[1] = 11 (months) $diferences[2] = 3 (years)
Ex. 3: Using the option 2 $diferences = sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 2); $diferences[0] = 21 (days) $diferences[1] = 11 (months) $diferences[2] = 3 (years).
Note: Formats between the two dates can be different but it must have days, months and years. You also need to know the internal format being returned for the macro to work correctly.
|