function formatEventtime($eventtime) {
/* difference between current time and the event time
$eventtime in timestamp */
$timediff = time() - ((int) $eventtime);
if ($timediff < 60) {
$formattedtime='just now';
} else if ($timediff < 3600) {
$timediff = round($timediff / 60);
if ($timediff == 0)
$timediff = 1;
if ($timediff > 1)
$formattedtime=$timediff.' minutes left';
$formattedtime='a minute left';
} else if ($timediff < 86400) {
$timediff = round($timediff / 3600);
if ($timediff == 0) $timediff = 1;
if ($timediff > 1)
$formattedtime=$timediff. 'hours left';
$formattedtime='one hour left';
} else {
$timediff = round($timediff / 86400);
if ($timediff == 0) $timediff = 1;
if ($timediff > 1)
$formattedtime=$timediff. ' days left'
$formattedtime='yesterday';
}
return $formattedtime ;
}
[Monday, March 16, 2009
|
0
comments
]
Popular Posts
- Elgg : The most popular open source social networking platform
- function to check whether the year given is a leap year or not
- php Questions
- Php Questions
- Php Questions
- errrors in php
- php Questions
- mysql
- Ansewer This What is the output of the following code?
- How to find out the Mysql storage engine type of a table.
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.