I have 2 date fields for when a candidate got a degree . One is DATE FROM AND THE OTHER IS DATE T0
I want a warning or pop if to date is later than from date. eg if FROM date is 12/2/1990 to date can not be 10/1/1989 .
How to make From date later than To date
-
- User
- Posts: 435
How to make From date later than To date
-
- User
- Posts: 11905
You may improve the code by checking whether the value is empty (null) or not:
if (!empty($rsnew["DateFrom"]) && !empty($rsnew["DateTo"])) {
if (strtotime($rsnew["DateFrom"]) > strtotime($rsnew["DateTo"])) {
$this->setFailureMessage("<strong>Date From</strong> cannot be greater than <strong>Date To</strong>.");
return false;
}
}