Hi Khuram 

I use this function 

function daysLeft($startDate,$endDate=false){
                // convert to timestamps

                $start_stamp = strtotime($startDate);
                $end_stamp   = ($endDate)?strtotime($endDate):time();

                if($start_stamp > $end_stamp){
                        // start date is passed end date
                        return "0";
                }
                $difference = $end_stamp - $start_stamp;
                return floor($difference/(24*60*60));
}

echo  daysleft("today", "01/05/2005");

Note, remeber to use the correct dat format otherwise you will see
some unexpected results.

Jarratt 


On Mon, 3 Jan 2005 02:33:58 -0800 (PST), khuram noman
<[EMAIL PROTECTED]> wrote:
> Hi
> 
> Is there any function avialable in PHP to calculate
> the no of days by passing 2 dates like 1 argument is
> 1/1/2005 and the second one is 1/2/2005 then it
> returns the no of days or how can i do that if there
> is no builtin function .
> 
> Regards
> Khuram Noman
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to