Jump to content
MakeWebGames

Recommended Posts

Posted

Does anyone know how to make Age: into days instead of like saying week... For example: 14 days old it wouldn't say 2 weeks, it would say 14 Days ?

The bit of code is in classes.php, but I'm not sure how to modify it to change it.. Please help me (: Thank You.

Posted

I'm assuming this is where to edit to make it days instead of week(s), month(s), year(s)

function howlongtil($ts) {
  $ts=$ts - time();
  if ($ts<1)
  	// <1 second
  	return " NOW!";
  elseif ($ts==1)
  	// <1 second
  	return $ts." second";
  elseif ($ts<60)
  	// <1 minute
  	return $ts." seconds";
 elseif ($ts<120)
  	// 1 minute
 	return "1 minute";

 elseif ($ts<60*60)
  	// <1 hour
  	return floor($ts/60)." minutes";
  elseif ($ts<60*60*2)
  	// <2 hour
  	return "1 hour";
	elseif ($ts<60*60*24)
  	// <24 hours = 1 day
  	return floor($ts/(60*60))." hours";
	elseif ($ts<60*60*24*2)
  	// <2 days
  	return "1 day";
	elseif ($ts<(60*60*24*7))
  	// <7 days = 1 week
    	return floor($ts/(60*60*24))." days";
  elseif ($ts<60*60*24*30.5)
  	// <30.5 days ~  1 month
  	return floor($ts/(60*60*24*7))." weeks";
	elseif ($ts<60*60*24*365)
  	// <365 days = 1 year
  	return floor($ts/(60*60*24*30.5))." months";
  else
  	// more than 1 year
  	return floor($ts/(60*60*24*365))." years";
};

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...