Login   Register  
PHP Classes
elePHPant
Icontem

File: userman.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Abhishek Kumar Srivastava  >  CalcDate  >  userman.php  >  Download  
File: userman.php
Role: Example script
Content type: text/plain
Description: User help file
Class: CalcDate
Calculate the difference between two dates
Author: By
Last change:
Date: 2006-03-03 02:18
Size: 2,463 bytes
 

Contents

Class file image Download
<?php
    
require_once ("CalcDate.php");
    
$Timestamp1 "1040378099";
    
$Timestamp2 "1041378099";
    
$CalcDateObject = new CalcDate();
    
    
// calculate difference between 2 timestamps

    
$DateDiff $CalcDateObject->CalculateDateDifference($Timestamp1,$Timestamp2);
    echo 
"<br><pre>";
    echo 
"difference between 2 timestamps";
    echo 
"<br>First timestamp: " $Timestamp1;
    echo 
"<br>Second timestamp: " $Timestamp2;
    echo 
"<br>Difference in Years: " $DateDiff['years'];
    echo 
"<br>Difference in Months: " $DateDiff['months'];
    echo 
"<br>Difference in Weeks: " $DateDiff['weeks'];
    echo 
"<br>Difference in Days: " $DateDiff['days'];

    
// calculate difference between timestamp and current date

    
$DateDiff $CalcDateObject->CalculateDateDifference($Timestamp1);
    echo 
"</pre><br><pre>";
    echo 
"difference between timestamp and current date";
    echo 
"<br>First timestamp: " $Timestamp1;
    echo 
"<br>Difference in Years: " $DateDiff['years'];
    echo 
"<br>Difference in Months: " $DateDiff['months'];
    echo 
"<br>Difference in Weeks: " $DateDiff['weeks'];
    echo 
"<br>Difference in Days: " $DateDiff['days'];

    
// calculate difference difference between 2 dates

    
$Date1 '2004-12-10';
    
$Date2 '2006-01-25';
    
$Timestamp1 $CalcDateObject->CalculateTimestampFromCurrDatetime($Date1);
    
$Timestamp2 $CalcDateObject->CalculateTimestampFromCurrDatetime($Date2);
    
$DateDiff $CalcDateObject->CalculateDateDifference($Timestamp1$Timestamp2);
    echo 
"</pre><br><pre>";
    echo 
"difference between 2 dates";
    echo 
"<br>First date: " $Date1;
    echo 
"<br>Second date: " $Date2;
    echo 
"<br>Difference in Years: " $DateDiff['years'];
    echo 
"<br>Difference in Months: " $DateDiff['months'];
    echo 
"<br>Difference in Weeks: " $DateDiff['weeks'];
    echo 
"<br>Difference in Days: " $DateDiff['days'];


    
// calculate difference between date and current date

    
$Date1 '2004-12-10';
    
$Timestamp1 $CalcDateObject->CalculateTimestampFromCurrDatetime($Date1);
    
$DateDiff $CalcDateObject->CalculateDateDifference($Timestamp1);
    echo 
"</pre><br><pre>";
    echo 
"difference between date and current date";
    echo 
"<br>First date: " $Date1;
    echo 
"<br>Second date: " $Date2;
    echo 
"<br>Difference in Years: " $DateDiff['years'];
    echo 
"<br>Difference in Months: " $DateDiff['months'];
    echo 
"<br>Difference in Weeks: " $DateDiff['weeks'];
    echo 
"<br>Difference in Days: " .  $DateDiff['days'];
?>