Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Notices

Reply
Thread Tools
  #1  
Old 22nd June 2010, 06:14
ajax's Avatar
ajax ajax is offline
Senior Member
 
Join Date: Apr 2009
United Kingdom
Posts: 165
Smile [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



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];

__________________
"ALWAYS BE YOURSELF.
UNLESS YOU CAN BE A UNICORN.
THEN ALWAYS BE A UNICORN."
Reply With Quote
Reply

Tags
format , pre , tbdev , time


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 16:03. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2025, vBulletin Solutions Inc.