note 22440 added to function.date
| From: | amitkoth at yahoo dot com | Date: | Tue, 18 Jun 2002 15:08:50 +0000 |
| Subject: | note 22440 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31976@lists.php.net to get a copy of this message | ||
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");
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+22440
http://master.php.net/manage/user-notes.php?action=delete+22440
http://master.php.net/manage/user-notes.php?action=reject+22440