Return to Snippet

Revision: 10397
at December 26, 2008 12:21 by Garciat


Updated Code
/* --> Dont paste this line <-- */
			$d = $time - $timestamp;
			if ($d < 60)
				return $d." second".(($d==1)?'':'s')." ago";
			else
			{
				$d = floor($d / 60);
				if($d < 60)
					return $d." minute".(($d==1)?'':'s')." ago";
				else
				{
					$d = floor($d / 60);
					if($d < 24)
						return $d." hour".(($d==1)?'':'s')." ago";
					else
					{
						$d = floor($d / 24);
						if($d < 7)
							return $d." day".(($d==1)?'':'s')." ago";
						else
						{
							$d = floor($d / 7);
							if($d < 4)
								return $d." week".(($d==1)?'':'s')." ago";
						}//Week
					}//Day
				}//Hour
			}//Minute

Revision: 10396
at December 26, 2008 12:19 by Garciat


Updated Code
/* --> Dont paste this line <-- */
			$d = $time - $timestamp;
			if ($d < 60)
				return $d." second".(($d==1)?'':'s')." ago";
			else
			{
				$d = round($d / 60);
				if($d < 60)
					return $d." minute".(($d==1)?'':'s')." ago";
				else
				{
					$d = round($d / 60);
					if($d < 24)
						return $d." hour".(($d==1)?'':'s')." ago";
					else
					{
						$d = round($d / 24);
						if($d < 7)
							return $d." day".(($d==1)?'':'s')." ago";
						else
						{
							$d = round($d / 7);
							if($d < 4)
								return $d." week".(($d==1)?'':'s')." ago";
						}//Week
					}//Day
				}//Hour
			}//Minute

Revision: 10395
at December 26, 2008 12:18 by Garciat


Updated Code
/* --> Dont paste this line <-- */
			$d = $time - $timestamp;
			if ($d < 60)
				return $d." second".(($d==1)?'':'s')." ago";
			else
			{
				$d = round($d / 60);
				if($d < 60)
					return $d." minute".(($d==1)?'':'s')." ago";
				else
				{
					$d = round($d / 60);
					if($d < 24)
						return $d." hour".(($d==1)?'':'s')." ago";
					else
					{
						$d = round($d / 24);
						if($d < 7)
							return $d." day".(($d==1)?'':'s')." ago";
						else
						{
							$d = round($d / 7);
							if($d < 1)
								return $d." week ago";
						}//Week
					}//Day
				}//Hour
			}//Minute

Revision: 10394
at December 24, 2008 12:07 by Garciat


Updated Code
/* --> Dont paste this line <-- */
			if ($d < 60)
				return $d." second".(($d==1)?'':'s')." ago";
			else
			{
				$d = round($d / 60);
				if($d < 60)
					return $d." minute".(($d==1)?'':'s')." ago";
				else
				{
					$d = round($d / 60);
					if($d < 24)
						return $d." hour".(($d==1)?'':'s')." ago";
					else
					{
						$d = round($d / 24);
						if($d < 7)
							return $d." day".(($d==1)?'':'s')." ago";
						else
						{
							$d = round($d / 7);
							if($d < 1)
								return $d." week ago";
						}//Week
					}//Day
				}//Hour
			}//Minute

Revision: 10393
at December 24, 2008 12:05 by Garciat


Initial Code
if ($d < 60)
				return $d." second".(($d==1)?'':'s')." ago";
			else
			{
				$d = round($d / 60);
				if($d < 60)
					return $d." minute".(($d==1)?'':'s')." ago";
				else
				{
					$d = round($d / 60);
					if($d < 24)
						return $d." hour".(($d==1)?'':'s')." ago";
					else
					{
						$d = round($d / 24);
						if($d < 7)
							return $d." day".(($d==1)?'':'s')." ago";
						else
						{
							$d = round($d / 7);
							if($d < 1)
								return $d." week ago";
						}//Week
					}//Day
				}//Hour
			}//Minute

Initial URL

                                

Initial Description

                                

Initial Title
esupergood - format_time() function tweak

Initial Tags

                                

Initial Language
PHP