Skip to content

Instantly share code, notes, and snippets.

@jeremeamia
Created March 26, 2010 18:39
Show Gist options
  • Save jeremeamia/345227 to your computer and use it in GitHub Desktop.
Save jeremeamia/345227 to your computer and use it in GitHub Desktop.
Find approximate time passed - Ko3
<?php // Uses Kohana 3 Framework
function time_ago($timestamp)
{
$time_ago = Date::span($timestamp);
foreach ($time_ago as $unit => $value)
{
if ($value > 0)
{
return 'about '.$value.' '.Inflector::singular($unit, $value).' ago';
}
}
return 'just now';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment