PHP Classes

File: example.php

Recommend this page to a friend!
  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: 18 years ago
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";
}

?>