Login   Register  
PHP Classes
elePHPant
Icontem

File: test.datetime.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrew Collington  >  class.datetime.php  >  test.datetime.php  >  Download  
File: test.datetime.php
Role: Example script
Content type: text/plain
Description: Some examples of use.
Class: class.datetime.php
A collection of date/time related functions.
Author: By
Last change:
Date: 2004-08-16 15:50
Size: 818 bytes
 

Contents

Class file image Download
<?php

    
require_once('class.datetime.php');
    
$time time() - rand(0172800);
    
$timeStr DateTime::timeStampToString($time);
    
    echo 
"Compare $time to "time(), ': 'DateTime::compareDates($timetime()), "<br /><br />\n\n";
    echo 
"$time to string: $timeStr<br /><br />\n\n";
    echo 
"$timeStr to time stamp: "DateTime::timeStringToStamp($timeStr), "<br /><br />\n\n";
    echo 
"$timeStr as 'Y-m-D': "DateTime::timeFormat($timeStr'Y-m-d'), "<br /><br />\n\n";
    echo 
"$time as 'Y-m-D': "DateTime::timeFormat($time'Y-m-d'), "<br /><br />\n\n";
    echo 
"From $time to "time(), ' as human readable: 'DateTime::timeToHumanReadable(time() - $time), "<br /><br />\n\n";
    echo 
"$time as 'fuzzy' time string: "DateTime::fuzzyTimeString($time), "<br /><br />\n\n";

?>