Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to select only by date from timestamp column in postgres?

Tags:

sql

postgresql

I have a table.

enter image description here

as you can see created_date column is timestamp field. now on selection i want to consider only date value. for e.g if i want to make selection of rows from today i want to do something like:-

select * from audit_logs where created_date = '2018-11-28';

the above query returns null. is it possible to make selection this way ?

like image 373
sagar limbu Avatar asked Nov 28 '18 05:11

sagar limbu


1 Answers

You can use date() function

select * from audit_logs where date(created_date) = '2018-11-28'
like image 200
Fahmi Avatar answered Sep 25 '22 12:09

Fahmi