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
- MySQL stored procedure&triggers
- php questions
- How we canmove into last changed position on info window close event On google map
- Pattern Matching in mysql
- MYSQL joins
- Jquery based dynamic adding and removal of html elements.
- securing a form with captcha
- Comparing a date with current date
- Css
- php Questions
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.