O
O
Optimus2015-11-11 16:29:17
PHP
Optimus, 2015-11-11 16:29:17

Valid dates, is there a ready check?

We write the date 2009-06-04 in the MySQL field of the DATE type - everything is OK, we are trying to set the 13th month of 2009-13-04 - it is written 0000-00-00, which means you need to check the date for validity before entering it into the database.
Question: what?
There are ready-made high-quality ones, i.e. so that the validator knows in which specific years February 29 can be, for example, and the allowable number of days in each month.
I didn’t understand the checkdate () chips manually:
var_dump(checkdate(12,20,2009)); //true
I accept from the form

echo $_POST['date'];
var_dump(checkdate($_POST['date']));

Displays: 12,20,2009
Warning: checkdate() expects exactly 3 parameters, 1 given in...
bool(false)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2015-11-11
Pyan @marrk2

php.net/manual/ru/function.checkdate.php
second link in google

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question