Re: Dates - adding to unix 86400 seconds not equal nextday
| From: | ioannes | Date: | Thu, 02 Sep 2004 23:38:47 +0000 |
| Subject: | Re: Dates - adding to unix 86400 seconds not equal nextday | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36025@lists.php.net to get a copy of this message | ||
The code that seems to work eventually is:
$thisdate=date("Y-m-d",$thisdate); // does not work where the delimiter is / rather than -, I thought various delimiters were allowed in the relaxed mysql code!
$query="SELECT ....WHERE..arrival<='$thisdate'&& DATE_ADD(arrival,INTERVAL nights-1 DAY) >'$thisdate'";
INTERVAL means what it says, so from 1/1/04 add an interval of 1 gives 3/1/04, not 2/1/04. Hence my -1.
John
----- Original Message ----- From: "ioannes" <ioannes@btinternet.com>
To: <php-db@lists.php.net>
Sent: Thursday, September 02, 2004 7:42 PM
Subject: Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday
The answer seems to be DATE_ADD but I haven't got it to work yet...asking the MySQL people.I need to do this in a SQL query: (arrival+nights)>='$thisdate'-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php