Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Neil Morgan  >  nmDate  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Date Class Examples
Class: nmDate
Date arithmetic operations and format conversion
Author: By
Last change:
Date: 2004-06-15 04:21
Size: 1,503 bytes
 

Contents

Class file image Download
<?php

/*
  Date Manager Class
    Copyright (C) 2004  Neil Morgan

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
    Lesser General Public License for more details.

    Author's details:
        Name: Neil Morgan
        Email: n.a.morgan@brighton.ac.uk

        Create and manipulate dates and times
        Algorithm implemented here was found at various sites on the web
        Try a GOOGLE search for "Julian Date" or "Julian Date Algorithm"
        
        NOTE: All method parameters to have UK format DMY NOT US format MDY 
                    However, returned date can be either DMY or MDY 
                    
                                         
*/

include_once('date.inc.php');

$today = new nmDate();
echo 
"Today: ".$today->GetDateDMY()."<br>";
echo 
"Julian: ".$today->Julian."<br><br>";

$today->AddMonths(1);
echo 
"Next Month: ".$today->GetDateDMY()."<br>";
echo 
"Julian: ".$today->Julian."<br><br>";

$today->AddYears(1);
echo 
"Next Year: ".$today->GetDateDMY()."<br>";
echo 
"Julian: ".$today->Julian."<br><br>";

echo 
"Seconds since Millennium: ".$today->GetDiff('01/01/2000','00:00:00')."<br><br>";


?>