Re: syntax for date math expressions
| From: | Maxim Maletsky | Date: | Wed, 03 Apr 2002 17:51:52 +0000 |
| Subject: | Re: syntax for date math expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91339@lists.php.net to get a copy of this message | ||
first of all your data seems to come from a DB to me. If it's so then read your DB manual for date functions. It would be way better and faster.
Otherwise, if you're so keen to let this duty job up to PHP then convert both dates into UNIX time format 'maketime()' deduct the values and put them through the 'date()' function.
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
www.PHPBeginner.com
maxim@phpbeginner.com
ROBERT MCPEAK writes:
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.phpMaxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com maxim@phpbeginner.com