First convert the dots to hyphens. Then recalculate to sceonds, cal the difference in seconds and re-format to days. This is it[php]<?php
// init values
$datefrom = '2006.7.12';
$dateto = '2006.7.20';
// convert dots to hyphens
$datefrom = str_replace('.' ,'-', $datefrom);
$dateto = str_replace('.' ,'-', $dateto);
// calc to seconds
$datefrom = strtotime($date from, 0);
$dateto = strtotime($date to, 0);
// calc difference in seconds
$difference = $dateto - $datefrom;
// reformat to days
$datediff = floor($differen ce / 86400);
// print result
echo "Difference is: $datediff days";
?>[/php]
Ronald :cool:
Comment