- date_diff: documentation ( source)
- date_create_from_format: documentation ( source)
<?php
$date1 = date_create_from_format("Y-m-d","2014-01-04");
$date2 = date_create_from_format("Y-m-d","2014-02-01");
$interval = date_diff($date1,$date2);
echo $interval->format('%d');