Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Community Cafe (http://www.bvlist.com/forumdisplay.php?f=18)
-   -   [TBDev] Pre time format. (http://www.bvlist.com/showthread.php?t=5108)

ajax 22nd June 2010 06:14

[TBDev] Pre time format.
 
Hey again,maybe now some can help with pre times formatting?

Now I see it like:
Uploaded 2010-06-20 13:12:22 after pre

But would be great if i can see it like:
Uploaded 13hours 12mins 22sec after pre


:coffee:
What code You need to see?

Function at global.php:
PHP Code:

function ago($seconds){
$day=date("j",$seconds)-1;
$month=date("n",$seconds)-1;
$year=date("Y",$seconds)-1970;
$hour=date("G",$seconds)-1;
$minute=(int) date("i",$seconds);
$returnvalue=false;
if(
$year){
if(
$year==1$return[]="1 year"; else $return[]="$year years";
}
if(
$month){
if(
$month==1$return[]="1 month"; else $return[]="$month months";
}
if(
$day){
if(
$day==1$return[]="1 day"; else $return[]="$day days";
}
if(
$hour){
if(
$hour==1$return[]="1 hour"; else $return[]="$hour hours";
}
if(
$minute&&$minute!=00){
if(
$minute==1){
$return[]="1 minute";
}else{
$return[]="$minute minutes";
}
}
for(
$i=0;$i<count($return);$i++){
if(!
$returnvalue){
$returnvalue=$return[$i];
}elseif(
$i<count($return)-1){
$returnvalue.= ", ".$return[$i];
}else{
$returnvalue.= " and ".$return[$i];
}
}
return 
$returnvalue;

}

function 
getpre($name$type)
{
$pre['regexp'] = "|<td>(.*)<td>(.*)<td>(.*)</table>|";
$pre['url'] = "http://doopes.com/?cat=454647&lang=0&num=2&mode=0&from=&to=&exc=&inc=" $name "&opt=0";
$pre['file'] = @file_get_contents($pre['url']);
preg_match($pre['regexp'], $pre['file'], $pre['matches']);
/**
* Types:
* 1 = Time
* 2 = Category
* 3 = Realesename
*/
return $pre['matches'][$type];




All times are GMT +2. The time now is 18:04.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.