I'm using a PHP function to count days between start date and end date for courses on a website. The function itself works flawless, however I'd like the counting to start from 1 as standard instead of 0.
My code looks like this
function dateDifference($start_date, $end_date) {
// calulating the difference in timestamps
$diff = strtotime($start_date) - strtotime($end_date);
// 1 day = 24 hours
// 6 * 60 * 60 = 86400 seconds
return ceil(abs($diff / 86400));
}
I guess the answer to this question is pretty straight forward however I'm not that wandered in PHP.
Thanks!
Aucun commentaire:
Enregistrer un commentaire