note 22440 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 11 Oct 2003 16:50:03 +0000 |
| Subject: | note 22440 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58257@lists.php.net to get a copy of this message | ||
Note Submitter: amitkoth@yahoo.com
----
Often you have this problem - you need to feed the SQL query handler two dates for a select
statement, and they need to be in the right format. Ie. for MySQL select ... from .... where date
between 2002-03-04 and 2002-03-06, in exactly that format. Use the code below to make it work:
//the date in 1 month in SQL friendly format
$futuremonth=(date("m")+1);
$newfuturemonth=$futuremonth;
//does format checking on the month that is one month ahead
if ($futuremonth<10) {
$newfuturemonth="0".$futuremonth;
}
elseif ($futuremonth>12) {
$newfuturemonth="01";
}
$in4weeks=date("Y")."-".$newfuturemonth."-".date("d");