PHP Classes

File: checkDate.php

Recommend this page to a friend!
  Classes of Carl Friis-Hansen   unixDate   checkDate.php   Download  
File: checkDate.php
Role: Example script
Content type: text/plain
Description: Web page to check class
Class: unixDate
Manipulate dates using the UNIX date command
Author: By
Last change: Changed listing priority
Date: 15 years ago
Size: 1,399 bytes
 

Contents

Class file image Download
<?php



 
/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **

  Simple example using web interface.
  Should output something like:

  The future: 2009/06/23 - 15:00 - CET

  ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */

 
require_once "./class.unixDate.php";

 
$date = new unixDate;
 
$result1 = $date->date();
 
$result2 = $date->date( "now +1 year +2 days +5 hours +30 minutes",
                         
"%Y/%0m/%0d - %0k:%0M - %Z" );

  print
"<html><head><title>Check Date</title></head><body>\n";
  print
"<h2>Checking class.unixDate.php</h2>\n";
  print
"------------------------------------------------------<br />\n";
  print
"The future: ".$result2."<br />\n";
  print
"is right now plus 1 year 2 days 5 hours and 30 minutes.<br />\n";
  print
"Right now is by the way ".$result1."<br />\n";
  print
"------------------------------------------------------<br />\n";
  print
"2008/12/15 +30 days = ".
       
$date->date( "2008/12/15 +30 days", "%Y/%0m/%0d" ).
       
"<br />\n";
  print
"------------------------------------------------------<br />\n";
  print
"2009/01/14 -30 days = ".
       
$date->date( "2009/01/14 -30 days", "%Y/%0m/%0d" ).
       
"<br />\n";
  print
"------------------------------------------------------<br />\n";
  print
"</body></html>";



?>