Location: PHPKode > scripts > CalcDate > calcdate/userman.php
<?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'];
?>
Return current item: CalcDate