Skip to content

diegofelix/relativetime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Relative Time

This class is based in a class made by Martin Angelov in tutorialzine.com

Generate a relative time based on date or time passed.

Installation

Run a bundle install

php artisan bundle:install relativetime

Register the bundle in application/bundles.php

return array(

	'relativetime' => array('auto' => true)

);

Examples

//Assuming today is 2012-10-01 12:00:00

echo RelativeTime::get(); // prints "just now"
echo RelativeTime::get('2012-07-01'); // prints "3 months ago"
echo RelativeTime::get('+15 seconds'); //prints "15 seconds from now"
echo RelativeTime::get('2013-03-01'); //prints "5 months from now"
// and so on

Try yourself!

About

Show relative times like "10 minutes ago"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages