sc_date_dif_2({Date1}, "Format Date1", {Date2}, "Format Date2", Option)

Calculates the difference between two dates (passed as parameters) returning the amount of days, months and years.


The result is returned in an array structure, where the index 0 have the amount of days, the index 1 have the amount of months and the index 2 have the amount 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:
{differences} =
sc_date_dif_2 ({date1}, "yyyy-mm-dd", {date2}, "mm/dd/yyyy", 1);
{dif_days} = {differences[0]};
{dif_months} = {differences[1]};
{dif_years} = {differences[2]};

Ex. 2:
{differences} =
sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 1);
{differences[0]} = 20 (days)
{differences[1]} = 11 (months)
{differences[2]} = 3 (years)


Ex. 3: Using the option 2
{differences} =
sc_date_dif_2 ("2000-05-01", "yyyy-mm-dd", "04/21/2004", "mm/dd/yyyy", 2);
{differences[0]} = 21 (days)
{differences[1]} = 11 (months)
{differences[2]} = 3 (years).


Note: Formats between the two dates can be different but it must have days, months and years