Prueba esto:
(Las fechas tienen que estar en segundos, con strtotime() )
Eso debería servir.
Comprueba que esté bien (no toy seguro, apenas lo probe) con esto:
Código PHP:
Ver original<?
if (isset($_POST['fecha1'])) { $posted=true;
}else{$posted=false;}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
<script>
$(document).ready(function() {
$('#fecha1').datepicker();
$('#fecha2').datepicker();
});
</script>
</head>
<body>
<form action="restafechas.php" method="post">
<input name="fecha1" id="fecha1" type="text" />
<input name="fecha2" id="fecha2" type="text" />
<input name="Enviar" type="submit" />
</form>
<?
if ($posted) {
echo date('l jS \of F Y h:i:s A',$fecha1)."<br />"; echo date('l jS \of F Y h:i:s A',$fecha2)."<br />"; echo floor(($fecha2 - $fecha1) / 1296000)+1 . "<br />";
}
?>
</body>
</html>
Para que funcione llama al archivo restafechas.php