PDA

View Full Version : Issue in count date from date range



newphpbees
06 Mar 2012, 06:51 PM
Hi...

I encountered problem in my counting number of dates from date to date.

for example :
he file leave:

· Feb. 18, Saturday

· Feb. 20, Monday

· Feb. 21, Tuesday


$DATE_LEAVE_FROM = 2012-02-18
$DATE_LEAVE_TO = 2012-02-21

Using this code:



<?php
$DATE_LEAVE_FROM = $_GET['DATE_LEAVE_FROM'];
$DATE_LEAVE_TO = $_GET['DATE_LEAVE_TO'];
$DATE_FROM = strtotime($DATE_LEAVE_FROM, 0);
$DATE_TO = strtotime($DATE_LEAVE_TO, 0);

$difference = ($DATE_TO - $DATE_FROM);
$HOURS_LEAVE = floor($difference / 86400);
?>

usiing this code the output is 4, because of the from date to date range which is correct.

BUt I need to count only the date which is from Monday to Saturday or should I say don't count date which is Sunday..

Is it possible?How?

Thank you so much