Documentation

CheckFilterDates

CheckFilterDates(
 string date1,
 string date2,
 string &is_date1_wrong,
 string &is_date2_wrong,
 string &is_date2_less_date1
);

This function checks if the two dates are correct and compares them. Usually the function is used in filters to check if the inputted time interval is correct.

Function parameters

ParameterDescription
date1 First date of interval ("from").
date2 Second date of interval ("to").
is_date1_wrong This parameter is a reference to an original variable. If it contains "Y" on return, the date specified in the date1 parameter is incorrect for the date format of the current site (language).
is_date2_wrong This parameter is a reference to an original variable. If it contains "Y" on return, the date specified in the date2 parameter is incorrect for the date format of the current site (language).
is_date2_less_date1 This parameter is a reference to an original variable. If it contains "Y" on return, the date specified in the parameter date1 is greater than that in date2, which is incorrect if a time interval is being specified.

See Also

Examples of use

<?
CheckFilterDates("10.01.2003", "15.02.2004", $date1_wrong, $date2_wrong, $date2_less);
if ($date1_wrong=="Y") echo "Incorrect format of the date1!";
if ($date2_wrong=="Y") echo "Incorrect format of the date2!";
if ($date2_less=="Y") echo "Date1 is greater than the date2!";
?>


© «Bitrix24», 2001-2024
Up