Topic: Date Validations in PHP

Read some information on date validating (isdate, checkdate, strtotime, etc...), but which is the best way to do date validating for the following:

The start and end dates will be specified from month, day, and year drop-down menus.

Validate that start date and end date are valid dates.
Validate that start date is greater than or equal to today.
Validate that end date is greater than or equal to start date.

Then what is the syntax to convert these dates (mm/dd/yyyy) to unix timestamp?

Thank you.

Re: Date Validations in PHP

Validate that start date and end date are valid dates. | checkdate
Validate that start date is greater than or equal to today. | strtotime or mktime, compare the unix timestamp generated
Validate that end date is greater than or equal to start date. | strtotime or mktime, compare the unix timestamp generated
Then what is the syntax to convert these dates (mm/dd/yyyy) to unix timestamp? | strtotime or mktime

Re: Date Validations in PHP

in the first you
$m=?11?;
$d=?31?;
$y=?05?;
If(!checkdate($m,$d,$y)){
echo ?invalid date?;
}else {
echo ?Entry date is correct ?;
}

be less than 1 or greater than 12.

$month = min(12, max(1, intval($month)));


for feb month check
if($day > 28)
$day = ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 29 : 28

Re: Date Validations in PHP

Huh? There's no need to do that validation when you have check_date...