PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Taha Paksu  >  Ultimate Date Parser  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example & test file
Class: Ultimate Date Parser
Parse and manipulate dates
Author: By
Last change:
Date: 3 years ago
Size: 1,149 bytes
 

Contents

Class file image Download
<?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."









?>