PHP Classes

File: dateformatter.sample.php

Recommend this page to a friend!
  Classes of Nicolas   DateFormater   dateformatter.sample.php   Download  
File: dateformatter.sample.php
Role: Example script
Content type: text/plain
Description: sample use of the class
Class: DateFormater
display a date with java date pattern
Author: By
Last change:
Date: 21 years ago
Size: 2,088 bytes
 

Contents

Class file image Download
<html>
    <head>
        <title>DateFormatter class (nbui@wanadoo.fr)</title>
        <style type="text/css">
        <!--
            TD.header {
                font-family: Verdana; font-size: 12px; font-weight: bold
            }
            TD.title {
                font-family: Verdana; font-size: 11px; font-weight: bold
            }
            TD.result {
                font-family: Verdana; font-size: 10px; font-weight: bold; color: #006600
            }
        //-->
        </style>
    </head>
<body>
<?php

/*****************************************\
* Using the DateFormatter class *
\*****************************************/
// including class
require "class.dateformatter.php";

// init
$dateFormatter = new DateFormater();

// getting the current time
$currentTimeSecond = time();

?>
<table cellpadding=4 cellspacing=1 border=0 bgcolor=#cdcdcd width=600>
<tr>
    <td bgcolor=#efefef class='header' colspan=2>DateFormatter : test example</td>
</tr>
<tr>
    <td bgcolor=#ffffff class='title'>&middot; time()</td>
    <td bgcolor=#ffffff class='result'><?php echo $currentTimeSecond;?></td>
</tr>
<tr>
    <td bgcolor=#ffffff class='title'>&middot; date using php : <font color=#ff0000>Y.m.d \a\t H:i:s</font></td>
    <td bgcolor=#ffffff class='result'><?php echo $dateFormatter->formatDate("Y.m.d \\a\\t H:i:s", $currentTimeSecond)?></td>
</tr>
<tr>
    <td bgcolor=#ffffff class='title'>&middot; date using java : <font color=#ff0000>yyyy.MM.dd 'at' HH:mm:ss</font></td>
    <td bgcolor=#ffffff class='result'><?php echo $dateFormatter->formatDate("yyyy.MM.dd 'at' HH:mm:ss", $currentTimeSecond, TRUE)?></td>
</tr>
<tr>
    <td bgcolor=#ffffff class='title'>&middot; date using php : <font color=#ff0000>l, d F, Y</font></td>
    <td bgcolor=#ffffff class='result'><?php echo $dateFormatter->formatDate("l, d F, Y (H:i)", $currentTimeSecond)?></td>
</tr>
<tr>
    <td bgcolor=#ffffff class='title'>&middot; date using java : <font color=#ff0000>EEEE, dd MMMM, yyyyy</font></td>
    <td bgcolor=#ffffff class='result'><?php echo $dateFormatter->formatDate("EEEE, dd MMMM, yyyyy (HH:mm)", $currentTimeSecond, TRUE)?></td>
</tr>
</table>
</body>
</html>