Blog Details

How to count no. of days between two dates in PHP


                                
                                    [code lang="php"]
<?php

function dateDiff($start, $end) {

$start_ts = strtotime($start);

$end_ts = strtotime($end);

$diff = $end_ts - $start_ts;

return round($diff / 86400);

}

echo dateDiff("2010-07-01", "2010-07-10");

?>
[/code]

 

Output :

9
                                    


Categories

Core_PHP

Latest posts

13.05.14
Implementing CRUD Operations ΒΆ

<ul> <li>Now comes the fun part. We would like t

13.05.14
View

<ol> <li><a href="http://www.yiiframework.com/do

13.05.14
Creating Model

<ol> <li><a href="http://www.yiiframework.com/do

Get Free Quote