<?php
include("DateUtil.php");
$date = DateUtil::getDateInDesiredFormat("02-28-1976", "dd-mm-yyyy", "-", ",");
if($date == false) {
echo "Invalid date";
} else {
echo "Date: " . $date;
}
echo "<br><br>";
echo "Time in Africa/Cairo is: " . DateUtil::getDesiredZoneTime("Africa/Cairo");
echo "<br><br>";
echo "Date Difference Test...";
echo "You will get the difference in days, to convert into years divide it by 365. <br>";
$dateDiff = (DateUtil::getDateDifference("02-22-2007", "08-21-1976", "-")/365);
if($dateDiff == false) {
echo "Invalida date...";
} else {
echo $dateDiff;
}
echo "<br><br>";
$date = DateUtil::getAddDaysToDate("12-16-2007", "90");
echo $date;
echo "<br><br>";
$date = DateUtil::getAddMonthsToDate("12-16-2007", "90");
echo $date;
echo "<br><br>";
$date = DateUtil::getAddYearToDate("12-16-2007", "10");
echo $date;
echo "<br><br>";
$weekDay = DateUtil::getWeekDay("12-16-2007");
echo $weekDay;
echo "<br><br>";
$unixTime = DateUtil::getDateInUnixTimeStamp("08-21-1976");
echo $unixTime;
echo "<br><br>";
$dateShift = DateUtil::dateShift("31 Dec 2007 23:59:59 GMT", "-3 months");
echo $dateShift;
?>
|