READ THE F***ING MANUAL!!!

http://php.net/round clearly shows you how to round to a whole number.

if you want to round ALL decimals up, then you might have to create
something from scratch, but

a) you need to read the relevant pages in the manual first
b) think about exactly what you want, then tell us


Justin French


on 12/03/03 4:06 PM, Ben C. ([EMAIL PROTECTED]) wrote:

> Is there a way not to round the number but get a whole number?   I don't
> want to have 1.5 days show as 2 days because it really has not gone into day
> 2?
> 
> -----Original Message-----
> From: Justin French [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2003 8:27 PM
> To: Ben C.; [EMAIL PROTECTED]
> Subject: Re: [PHP] Subtracting two dates
> 
> 
> <?
> $otherDate = "2003-11-15";                  // yyyy-mm-dd format
> $otherDateStamp = strtotime($otherDate);    // now a unix timestamp
> 
> $difference = time() - $otherDateStamp;     // diff in seconds
> ?>
> 
> Then you need to decide if you want to show days, or hours, or years
> difference...
> 
> I'll show you hours and days:
> 
> <?
> $differenceHours = $difference / 3600;      // 60secs x 60 mins
> $differenceDays  = $difference / 86400;     // 60 x 60 x 24 hours
> ?>
> 
> You then need to round the number using round().
> 
> 
> Justin
> 
> 
> 
> on 11/03/03 3:02 PM, Ben C. ([EMAIL PROTECTED]) wrote:
> 
>> There are a lot of artlicles on this but I need a simple solution.  I need
>> to subtract two dates as follows:
>> 
>> $date = date("Y-m-d");
>> $date1 = "2003-03-03";
>> $differencedate = ($date - $date1);
>> echo $differencedate;
>> 
>> When I do this I get 0.  Please help!
>> 
>> 
>> --------------------------------------------------------------------------
>> The content of this email message and any attachments are confidential and
>> may be legally privileged, intended solely for the addressee.  If you are
>> not the intended recipient, be advised that any use, dissemination,
>> distribution, or copying of this e-mail is strictly prohibited.  If you
>> receive this message in error, please notify the sender immediately by
> reply
>> email and destroy the message and its attachments.
>> 
> 
> ---
> [This E-mail scanned for viruses]
> 
> 


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

Reply via email to