PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of ashwin suresh morey   DateClass   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: usage of class file
Class: DateClass
Calculates the difference beween two dates
Author: By
Last change:
Date: 18 years ago
Size: 1,258 bytes
 

Contents

Class file image Download
<?php
    $firstDate
= date("Y-m-d");
    echo
"firstDate:";
    echo
"<br>";
    echo
$firstDate;
   
$nextTime = time() + (365 * 24 * 60 * 60);
   
$secondDate = date('Y-m-d',$nextTime);
    echo
"<br>";
    echo
"secondDate:";
    echo
"<br>";
    echo
$secondDate;
    require(
"dateClass.php");

    echo
"<br>";
    echo
"difference in seconds:";
    echo
"<br>";
   
$seconds = new dateDiff($firstDate,$secondDate,s);
    echo
$seconds->calDiff();

    echo
"<br>";
    echo
"difference in minutes:";
    echo
"<br>";
   
$minutes = new dateDiff($firstDate,$secondDate,m);
    echo
$minutes->calDiff();

    echo
"<br>";
    echo
"difference in hours:";
    echo
"<br>";
   
$hours = new dateDiff($firstDate,$secondDate,h);
    echo
$hours->calDiff();

    echo
"<br>";
    echo
"difference in days:";
    echo
"<br>";
   
$days = new dateDiff($firstDate,$secondDate,d);
    echo
$days->calDiff();

    echo
"<br>";
    echo
"difference in months:";
    echo
"<br>";
   
$months = new dateDiff($firstDate,$secondDate,mm);
    echo
$months->calDiff();

    echo
"<br>";
    echo
"difference in years:";
    echo
"<br>";
   
$years = new dateDiff($firstDate,$secondDate,y);
    echo
$years->calDiff();

?>