RE: [PHP] Date aritmetic

2002-01-02 Thread Martin Towell

This isn't to pick on Carlos, but I've notice there's heaps of ppl who don't
read the manual, or do a search on the manual - I've found that many of my
questions have been answered by doing a search on the docs

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 2:20 PM
To: Carlos Fernando Scheidecker Antunes
Cc: PHP-GENERAL
Subject: Re: [PHP] Date aritmetic


Not mentioning that you could've taken a look at
http://www.php.net/manual/en/ref.datetime.php yourself, here goes:
$days_diff=(mktime(0,0,0,$month2,$day2,$year2)-mktime(0,0,0,$month2,$day2,$y
ear2))/86400;

Bogdan

Carlos Fernando Scheidecker Antunes wrote:

> Hello all,
>
> I would like to know if anyone could help me with the following issue:
>
> I have 6 variables, two holds a day, others the month and the last ones
the year. They are entered through drop-down-menus where the user selects
day, month and year for each date.
>
> I would like to know the difference in days between these two dates. Since
the dates are separated and each value day, month and year are stored on
separated variables I wonder who to proceed here. I need to know how many
days of separate each dates.
>
> Thank you in advance,
>
> Carlos Fernando
> Salt Lake City, UT.
> Linux User #207984


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



RE: [PHP] Date aritmetic

2002-01-02 Thread Martin Towell

convert both in dates into a time stamp using mktime()
subtract the two figures you get back
then divide by 86400 (60sec/min * 60min/hr * 24hr/day)


-Original Message-
From: Carlos Fernando Scheidecker Antunes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 12:57 PM
To: PHP-GENERAL
Subject: [PHP] Date aritmetic
Importance: High


Hello all,

I would like to know if anyone could help me with the following issue:

I have 6 variables, two holds a day, others the month and the last ones the
year. They are entered through drop-down-menus where the user selects day,
month and year for each date.

I would like to know the difference in days between these two dates. Since
the dates are separated and each value day, month and year are stored on
separated variables I wonder who to proceed here. I need to know how many
days of separate each dates. 

Thank you in advance,

Carlos Fernando
Salt Lake City, UT.
Linux User #207984




Re: [PHP] Date aritmetic

2002-01-02 Thread Bogdan Stancescu

Well, actually
$days_diff=(mktime(0,0,0,$month2,$day2,$year2)-mktime(0,0,0,$month1,$day1,$year1))/86400;
but you probably got that... :-)

Bogdan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Date aritmetic

2002-01-02 Thread Bogdan Stancescu

Not mentioning that you could've taken a look at 
http://www.php.net/manual/en/ref.datetime.php yourself, here goes:
$days_diff=(mktime(0,0,0,$month2,$day2,$year2)-mktime(0,0,0,$month2,$day2,$year2))/86400;

Bogdan

Carlos Fernando Scheidecker Antunes wrote:

> Hello all,
>
> I would like to know if anyone could help me with the following issue:
>
> I have 6 variables, two holds a day, others the month and the last ones the year. 
>They are entered through drop-down-menus where the user selects day, month and year 
>for each date.
>
> I would like to know the difference in days between these two dates. Since the dates 
>are separated and each value day, month and year are stored on separated variables I 
>wonder who to proceed here. I need to know how many days of separate each dates.
>
> Thank you in advance,
>
> Carlos Fernando
> Salt Lake City, UT.
> Linux User #207984


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]