Login   Register  
PHP Classes
elePHPant
Icontem

File: testScript.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gurdeep Singh  >  Date Util  >  testScript.php  >  Download  
File: testScript.php
Role: Example script
Content type: text/plain
Description: this is the example script to test the DateUtil class
Class: Date Util
Format and manipulate dates in several ways
Author: By
Last change:
Date: 2008-01-06 00:27
Size: 1,245 bytes
 

Contents

Class file image Download
<?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;
    
?>