public static function relativeTime(\DateTime $d){
		
		$second		= 1;
		$minute		= 60 * $second;
		$hour		= 60 * $minute;
		$day		= 24 * $hour;
		$month		= 30 * $day;

		$delta = \time() - $d->getTimestamp();

		if($delta < 1 * $minute){
			return $delta === 1 ? 'one second ago' : $delta . ' seconds ago';
		}

		if($delta < 2 * $minute){
			return 'a minute ago';
		}

		if($delta < 45 * $minute){
			return \floor($delta / $minute) . ' minutes ago';
		}

		if($delta < 90 * $minute){
			return 'an hour ago';
		}

		if($delta < 24 * $hour){
			return \floor($delta / $hour) . ' hours ago';
		}

		if($delta < 48 * $hour){
			return 'yesterday';
		}

		if($delta < 30 * $day){
			return \floor($delta / $day) . ' days ago';
		}

		if($delta < 12 * $month){
			$months = \floor($delta / $day / 30);
			return $months <= 1 ? 'one month ago' : $months . ' months ago';
		}
		else{
			$years = \floor($delta / $day / 365);
			return $years <= 1 ? 'one year ago' : $years . ' years ago';
		}
		
	}