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@xxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Thursday, September 02, 2004 7:42 PM
Subject: Re: 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
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php