Accurate way to calculate time

I am working on a project where a user can pick a date in this format ‘2013-06-30 12:00:00’, the date is then stored for later usage.

When the date is pulled the script calculates the time left to that specific date using strtotime and subtracting time to that then setting 6 different variables, the years, months, days, hour, minutes and seconds however I am getting varying results, if I reload the page the seconds may jump up instead of down.

I am doing it based on dividing according to 60 * 60 * 24 * 30 * 365


//$vars['target'] is the amount of seconds based on strtotime('2013-06-30 12:00:00')-time()
	if($vars['target'] > 31536000) {
		$years=floor($vars['target']/31536000);
		$vars['target']%=31536000;
	} else $years=0;
	if($vars['target'] > 2628000){
		$months=floor($vars['target']/2628000);
		$vars['target']%=2628000;
	} else $months=0;
	if($vars['target'] > 86400){
		$days=floor($vars['target']/86400);
		$vars['target']%=86400;
	} else $days=0;
	if($vars['target'] > 3600){
		$hours=floor($vars['target']/3600);
		$vars['target']%=3600;
	} else $hours=0;
	if($vars['target'] > 60){
		$minutes=floor($vars['target']/60);
		$vars['target']%=60;
	} else $minutes=0;
	$seconds=$vars['target'];

I modifed the script completely, now I am using the datetime and everything is working as expected