RE: [PHP] Include today's date in a SQL statement?
| From: | Jon Haworth | Date: | Wed, 05 Feb 2003 15:28:59 +0000 |
| Subject: | RE: [PHP] Include today's date in a SQL statement? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134426@lists.php.net to get a copy of this message | ||
Hi Brian,
> What would the SQL be to find a record where:
> start_date < today <= end_date
... WHERE start_date < today AND today <= end_date
If you're asking "how do I get today's date into an SQL statement", there
are two ways:
- use your DBMS's built-in function to get today's date
- use PHP's date() function to format a timestamp as YYYY-MM-DD
Cheers
Jon