Learning PHP and MySQL

Example 11-19 Creating a timestamp from the components of a date

<?php
   
echo("Validating:  5/31/2005<br>"); 
   if  (
checkdate(5,31,2005))  
     
echo('Date  accepted:  ');
     
$new_date=mktime(18,05,35,5,31,2005);
     echo  
date("r",$new_date);
 
}
 
else  {
   
echo  ('Invalid  date.');
 
}
 
echo("<br>");
?>

This code produces Figure 11-16 when run.

Posted by on 08/19 at 08:25 AM

Next entry: Example 11-20 The file_exists.php script checks to see if the file is there

Previous entry: Example 11-18 Validating two dates

<< Back to main