PostgreSQL - How to search by a date from datetime fields?

Search and show rows with a specific date

You have table actor with the column last_update type timestamp.

You want to search and show only the records with a specific date, let's say '2017-02-15'

SELECT
	*
FROM
	actor
WHERE
	last_update >= '2017-02-15'::date
	AND last_update < ('2017-02-15'::date + '1 day'::interval);

Or in another form:

SELECT
	*
FROM
	actor
WHERE
	last_update >= CAST('2017-02-15' AS DATE)
	AND last_update < (CAST('2017-02-15' AS DATE) + CAST('1 day' AS INTERVAL));
Search by a date value

*Need a good GUI Tool for PostgreSQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
*

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS.

TablePlus GUI Tool PostgreSQL

← All posts