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 Radovan Janjic  >  PHP Time Ago  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Time Ago
Compute the difference between two time values
Author: By
Last change:
Date: 2012-11-08 13:16
Size: 1,348 bytes
 

Contents

Class file image Download
<?php

include "time_ago.class.php";

$a = new time_ago;

// now
echo $a->ago('2012-11-07 11:14:30''2012-11-07 11:14:30'), '<br>';

// secund
echo $a->ago('2012-11-07 11:14:29''2012-11-07 11:14:30'), '<br>';

// secunds
echo $a->ago('2012-11-07 11:14:20''2012-11-07 11:14:30'), '<br>';

// minute
echo $a->ago('2012-11-07 11:13:30''2012-11-07 11:14:30'), '<br>';

// minutes
echo $a->ago('2012-11-07 11:11:30''2012-11-07 11:14:30'), '<br>';

// hour 
echo $a->ago('2012-11-07 10:11:30''2012-11-07 11:14:30'), '<br>';

// hours
echo $a->ago('2012-11-07 6:11:30''2012-11-07 11:14:30'), '<br>';

// yesterday
echo $a->ago('2012-11-06 6:11:30''2012-11-07 11:14:30'), '<br>';

// on week day
echo $a->ago('2012-11-04 6:11:30''2012-11-07 11:14:30'), '<br>';

// week
echo $a->ago('2012-10-31 6:11:30''2012-11-07 11:14:30'), '<br>';

// weeks
echo $a->ago('2012-10-24 6:11:30''2012-11-07 11:14:30'), '<br>';

// month 
echo $a->ago('2012-10-6 6:11:30''2012-11-07 11:14:30'), '<br>';

// months 
echo $a->ago('2012-04-6 6:11:30''2012-11-07 11:14:30'), '<br>';

// year  
echo $a->ago('2011-04-6 6:11:30''2012-11-07 11:14:30'), '<br>';

// years   
echo $a->ago('2008-04-6 6:11:30''2012-11-07 11:14:30'), '<br>';

// from now
echo "I was born "$a->ago('1988-04-26'), ".";