<?php
 
$start = microtime(true);
 
include_once "date.class.php";
 
$dc = new dateparser;
 
$date = "May 12th, 1968, 11:25 PM";
 
$format = "F jS, Y, h:i A";
 
 
echo "<pre>";
 
echo "Parsing date : " . $date ."<br>";
 
echo "Parse Result : " . print_r($dc->ParseDate($format,$date),true) . "<br>";
 
 
$new_format = "r";
 
 
echo "New date format : " . $new_format ."<br>";
 
echo "New format result : " . $dc->Format($new_format,$format, $date) . "<br>";
 
 
$compare_date = "May 12th, 1968, 11:25 AM";
 
echo "<br>Comparison with ".$compare_date."<br>";
 
echo "<br>Comparison Date Parse Result : ". print_r($dc->ParseDate($format,$compare_date),true) ."<br>";
 
echo "Is '". $date ."' after than '" . $compare_date . "' ?<br><br>";
 
 
switch ($dc->compare($dc->ParseDate($format,$date),$dc->ParseDate($format,$compare_date))){
 
    case "1" : echo "Yes it is later then first one"; break;
 
    case "0" : echo "No, they are equal dates";break;
 
    case "-1" : echo "No, first one is later than the second"; break;
 
}
 
 
echo "<br><br>Including, instantiating and executing all of these calculations took ". (microtime(true)-$start) . " seconds."
 
 
 
 
 
 
 
 
 
 
?>
 
 |