Time Sent Error

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

#minserror

3 replies · 419 views · started 14 years ago · 1 min read

2 participants
DeViLzHeLpEr Junior · 24 posts #1

Hi i been coding this time message was sent at for wapdesire v2 script but for some reason it only shows hours and seconds, and not minutes.. can somebody help me to fix this...

Heres what i have:

$noi = mysql_fetch_array(mysql_query("SELECT timesent FROM inbox WHERE id='".$id."'")); 
 $var1 = date("his",$noi[0]); 
 $var2 = time(); 
 $var21 = date("his",$var2); 
 $var3 = $var21 - $var1; 
 $var4 = date("his",$var3); 
 $main.="<b><p align=\"center\">This Message Was Sent</b><br/>";
 $remain = time() - $noi[0]; 
 $idle = gettimemsg($remain); 
 $main.="$idle ago<br/>";

For example it says this message was sent 7 hours 8 seconds ago. Never says how many minutes tho.. any help will be greatful

$XTREME$ Developer · 82 posts #2

share you core function gettimemsg , i ll troubleshoot it ?

DeViLzHeLpEr Junior · 24 posts #3

Function is

Hi mate here is the core function.

function gettimemsg($sec) 
{ 
//////////////////// 
$years=0; 
$months=0; 
$weeks=0; 
$days=0; 
$mins=0; 
$hours=0; 
if ($sec>59) 
{ 
$secs=$sec%60; 
$mins=$sec/60; 
$mins=(integer)$mins; 
} 

if ($mins>59) 
{ 
$hours=$mins/60; 
$hours=(integer)$hours; 
$mins=$mins%60; 
} 

if ($hours>23) 
{ 
$days=$hours/24; 
$days=(integer)$days; 
$hours=$hours%24; 
} 

if ($days>6) 
{ 
$weeks=$days/7; 
$weeks=(integer)$weeks; 
$days=$days%7; 
} 

if ($weeks>3) 
{ 
$months=$weeks/4; 
$months=(integer)$months; 
$weeks=$weeks%4; 
} 

if ($months>11) 
{ 
$years=$months/12; 
$years=(integer)$years; 
$months=$months%12; 
} 

if($years>0) 
{ 
if($years==1){$yearmsg="year";}else{$yearmsg="years";} 
if($months==1){$monthsmsg="month";}else{$monthsmsg="months";} 
if($days==1){$daysmsg="day";}else{$daysmsg="days";} 
if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";} 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($months!=0){$monthscheck="$months $monthsmsg ";}else{$monthscheck="";} 
if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";} 
if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";} 
if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";} 
if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$years $yearmsg $monthscheck$dayscheck$hourscheck$minscheck$secscheck"; 
} 

if(($years<1)&&($months>0)) 
{ 
if($months==1){$monthsmsg="month";}else{$monthsmsg="months";} 
if($days==1){$daysmsg="day";}else{$daysmsg="days";} 
if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";} 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";} 
if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";} 
if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";} 
if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$months $monthsmsg $dayscheck$hourscheck$minscheck$secscheck"; 
} 

if(($months<1)&&($weeks>0)) 
{ 
if($weeks==1){$weeksmsg="week";}else{$weeksmsg="weeks";} 
if($days==1){$daysmsg="day";}else{$daysmsg="days";} 
if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";} 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($days!=0){$dayscheck="$days $daysmsg ";}else{$dayscheck="";} 
if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";} 
if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";} 
if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$weeks $weeksmsg $dayscheck$hourscheck$minscheck$secscheck"; 
} 

if(($weeks<1)&&($days>0)) 
{ 
if($days==1){$daysmsg="day";}else{$daysmsg="days";} 
if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";} 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($hours!=0){$hourscheck="$hours $hoursmsg ";}else{$hourscheck="";} 
if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";} 
if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$days $daysmsg $hourscheck$minscheck$secscheck"; 
} 

if(($days<1)&&($hours>0)) 
{ 
if($hours==1){$hoursmsg="hour";}else{$hoursmsg="hours";} 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($minutes!=0){$minscheck="$mins $minsmsg ";}else{$minscheck="";} 
if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$hours $hoursmsg $minscheck$secscheck"; 
} 

if(($hours<1)&&($mins>0)) 
{ 
if($mins==1){$minsmsg="minute";}else{$minsmsg="minutes";} 
if($secs==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($secs!=0){$secscheck="$secs $secsmsg";}else{$secscheck="";} 

return "$mins $minsmsg $secscheck"; 
} 

if(($mins<1)&&($sec>0)) 
{ 
if($sec==1){$secsmsg="second";}else{$secsmsg="seconds";} 

if($sec!=0){$secscheck="$sec $secsmsg";}else{$secscheck="";} 

return "$secscheck"; 
}else{ 
return "Online!"; 
} 
} 
$XTREME$ Developer · 82 posts #4

Time Function

//////////////////////////gettimemsg

function gettimemsg($xtreme)
{
  $ds = floor($xtreme/60/60/24);
  if($ds > 0)
  {
    return "$xtreme days";
  }
  $hs = floor($xtreme/60/60);
  if($hs > 0)
  {
    return "$xtreme hours";
  }
  $ms = floor($xtreme/60);
  if($ms > 0)
  {
    return "$ms minutes";
  }
  return "$xtreme Seconds";
}

Try This Code, If Any Error Again Please pm Me I ll Help You ?

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close