/ Published in: PHP
Expand |
Embed | Plain Text
<?php /** * Calculating the difference between two dates * @author: Elliott White * @author: Jonathan D Eisenhamer. * @link: http://www.quepublishing.com/articles/article.asp?p=664657&rl=1 * @since: Dec 1, 2006. */ { // Set the default timezone to US/Eastern date_default_timezone_set( 'US/Eastern' ); } // Will return the number of days between the two dates passed in function count_days( $a, $b ) { // First we need to break these dates into their constituent parts: // Now recreate these timestamps, based upon noon on each day // The specific time doesn't matter but it must be the same each day // Subtract these two numbers and divide by the number of seconds in a // day. Round the result since crossing over a daylight savings time // barrier will cause this time to be off by an hour or two. } // Prepare a few dates // Calculate the differences, they should be 43 & 11353 ?>
Comments
Subscribe to comments
You need to login to post a comment.

hey..thanks your article ... but ..if i must check how many saturday in date range ($date1,$date2)? i need your help please
Could you provide an example of how to call this function please?