Define date boundaries in PHP
P粉546257913
P粉546257913 2023-08-08 19:34:46
0
1
392

I used some date functions surrounding the French Republic of 1792-1806. But I want to know if the (PHP8) date functions can handle these dates.

function CheckFrDate($CheckDate){ $BeginFrDate = date_create_from_format('d/m/Y', '22/09/1792'); $EndFrDate = date_create_from_format('d/m/Y', '22/09/1806'); if ( $CheckDate->getTimestamp() > $BeginFrDate->getTimestamp() && $CheckDate->getTimestamp() < $EndFrDate->getTimestamp()){ return 1; }else{ return -1; } }

So a date like September 23, 1793 should be fine. But my function keeps returning false.

P粉546257913
P粉546257913

reply all (1)
P粉366946380

If the date function returns false, you can get detailed error information by calling var_dump(date_get_last_errors()).

More information: https://www.php.net/manual/en/function.date-get-last-errors.php

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!