Jasmine22 Jasmine22 - 1 year ago 160
PHP Question

PostgreSQL run query for today's date

I found a lot of questions similar to mine, but none seemed to work
I have this query

$query= "SELECT * from jazz WHERE parsing_date = (todays date) ";

I want "
" to equal to today's date I work on PostgreSQL.
For it to get from my database all records that have today's date. Also
has date format.

Answer Source

In PostgreSQL there are next date-constants: CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP or universal function now().

Try next query in your case:

$query = "SELECT * from jazz WHERE parsing_date=CURRENT_DATE";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download