Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Pavel  >  Date Fmt  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Usage example
Class: Date Fmt
Format dates according to a format string
Author: By
Last change:
Date: 2011-07-02 06:24
Size: 773 bytes
 

Contents

Class file image Download
<?php
/*
  A sample file for DateFmt date/time formatter class.
  by Proger_XP | Full formatting reference: http://proger.i-forge.net/DateFmt/cWq
*/

require 'date.php';

$formatString 'Posted at h##m (AGO[s-d]IF>14[on d#my (D__)]).';
echo 
DateFmt::Format($formatStringtime() - 30), "\n";             // 30 sec ago
echo DateFmt::Format($formatStringtime() - 3600), "\n";           // 1 hour ago
echo DateFmt::Format($formatStringtime() - 24*3600), "\n";    // 5 days ago
echo DateFmt::Format($formatStringtime() - 20 24*3600), "\n";   // 20 days ago - output as date

// the same but in Russian:
$formatString 'Добавлено h##m (AGO[s-d]IF>14[d#my (D__)]).';
echo 
DateFmt::Format($formatStringtime() - 20 24*3600'ru'), "\n";