Citation de code source en ActionScriptn° 142
16 June 2014 à 10:50
Function calcDatediff(&fromdate As date, &todate As date) Returns number
Local number &days;
Local number &fromyear, &frommonth, &fromday;
Local number &toyear, &tomonth, &today;
Local date &fromdateTemp, &todateTemp;
If None(&fromdate) Or
None(&todate) Then
Return - 1; /* missing inputs */
End-If;
&fromyear = Year(&fromdate);
&frommonth = Month(&fromdate);
&fromday = Day(&fromdate);
&toyear = Year(&todate);
&tomonth = Month(&todate);
&today = Day(&todate);
&fromdateTemp = Date3(&fromyear, &frommonth, &fromday);
&todateTemp = Date3(&toyear, &tomonth, &today);
SQLExec("select %DateDiff(%DateIn(" | Quote(String(&fromdate)) | "), %DateIn(" | Quote(String(&todate)) | ")) from psoptions", &days);
Return &days;
End-Function;