1

I'm entering certain dates and validated using php but I found these errors he had ever had.

The function I use to verify if the date is valid or not is:

public function fecha($field){
    $field = '18-11-1901';
    if (date('d-m-Y', strtotime($field)) == $field) {
        print_r("bien".$field);
        exit;
        return true;
    } else {
        print_r("mal".$field);
        exit;
        return false;
    }
    return true;
}

At that time I try to roll a mistake, that the date is not correct. from 1901 down fails. But from 1902 up works well. Why does this happen ?.

Error list:

18-11-1901
18-11-1800

I understand that there are limits to the dates, but there is no way to fix it? Transforming it into another format or something?

NHTorres
  • 1,528
  • 2
  • 21
  • 39
  • 4
    You're trying to convert to a 32-bit signed timestamp with dates that fall outside the valid range for a 32-bit unsigned timestamp - [PHP Docs](http://nl1.php.net/manual/en/function.strtotime.php) `Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) ` – Mark Baker Nov 26 '15 at 17:17
  • @MarkBaker You can put this in response? Thank you! – NHTorres Nov 26 '15 at 17:22

0 Answers0