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: - Small changes
- Updated description
Date: 2013-05-28 15:09
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'), ".";