this is an option that only "sort of" works (converting to date/time);

$x = strtotime("2002-04-03") - strtotime("2002-04-02");

$x will contain 86400 which is the number of seconds in a "normal" day.
Since the days that some people use switch from daylight savings time to
standard time (and visa versa) there are a different number of seconds in
those days so simply dividing by some fixed value will not work (this is
what I mean by "sort of").

Some databases have a datadiff function, perhaps you can pass a query
something like

SELECT datediff("2002-04-03","2002-04-02") as difference from realtable

Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 11:02 AM
To: 'ROBERT MCPEAK'; [EMAIL PROTECTED]
Subject: RE: [PHP] syntax for date math expressions


Convert to date/time variable and perform arithmetic.

Otherwise, if these dates are from mysql, let mysql do it

-----Original Message-----
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 11:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] syntax for date math expressions


What is the php syntax for adding or subtracting dates?

For example, I'd like to do something like this:

2002-04-03 - 2002-04-02 = 1

or 

2002-04-03 - 2002-04-02 = 0000-00-01

or 

2002-04-03 + 0000-00-01 = 2002-04-03

etc.

Can anybody help this newbie?

Thanks!



-- 
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

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

Reply via email to