Q:

Checking a valid date in php not working

I have converted one variable into unix timestamp to checl whether it is valid date or not
.Format is dd/mm/yy . My code is below
<?php
$date1='24/11/2013';
$date2='09/11/2013';
$date3='yuyuy1909090';//CAN BE ANYTHING

if(strtotime($date1)>0){
    echo "valid date1";
}
if(strtotime($date2)>0){
    echo "valid date2";
}
if(strtotime($date3)>0){
    echo "valid date2";
}   

?>

but if says only $date2 is valid, i cannot change the format of date because it comes form 3rd party flat file... 
What could be the issue?

A:

If you know the valid format, you can use:
$date = DateTime::createFromFormat('d/m/Y', $date1);
if ( $date->getTimestamp() > 0 ) {
  echo 'valid date1';
}

