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
- Running a perl script from PHP
- Riverdashboard in Elgg
- How to add or remove WWW on URLs using htaccess.
- solving the packaging problem in PHP
- Handling the multiple checkboxes with Jquery for Check All, Uncheck All and get values from selected values V2
- How to create a plugin in elgg.
- Add/Remove text control using javascript
- Function to find out last 12 months details from the current date
- Common Array functions in php
- Checking for a valid date for date of birth and age verification - Codeigniter

0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.