Login   Register  
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 Vijay Kiran Maddireddy  >  Date Validate and Compare  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script with sample dates
Class: Date Validate and Compare
Validate and compare dates
Author: By
Last change:
Date: 2006-01-11 16:31
Size: 623 bytes
 

Contents

Class file image Download
<?php

include_once("DateAdd.class.php");

$fromdate = new DateCK("01-31-2005","-");
$todate = new DateCK("01/32/2005","/");
echo 
"<br>From Date : ";
$fromdate->display();
echo 
"<br>To Date : ";
$todate->display();
$compareStatus $fromdate->comparedates($todate); 
if (
$compareStatus==-10) {
    echo 
"<br>Invalid dates";
}
else if (
$compareStatus==-1) {
    echo 
"<br>From date is greater than to date";
}
else if (
$compareStatus==0) {
    echo 
"<br>Both dates are the same";
}
else if (
$compareStatus==1) {
    echo 
"<br>To date is greater than from date";
}
else {
    echo 
"<br>Failed to compare";
}

?>