Reyalino Posted February 3, 2017 Report Share Posted February 3, 2017 I have date column on postgresql table with timestamp format i.e "2017-01-01 22:00:00". Does anybody know how to select those date column without put the hour on the queries? What I type for selecting those date is "select date from table where date='2017-01-01' " but nothing appear on the result. Look forward to hear from you guys !! regards Quote Link to comment Share on other sites More sharing options...
Lurker Posted February 3, 2017 Report Share Posted February 3, 2017 how bout this : SELECT * FROM table WHERE dt::date = '2017-01-01' Quote Link to comment Share on other sites More sharing options...
Reyalino Posted February 3, 2017 Author Report Share Posted February 3, 2017 Still doesn't work for me.., here is my Table. As alternative I use the query below, but not a simple once in my opinion: Quote SELECT* FROM table WHERE date BETWEEN '2017-01-01 00:00:00' AND ' '2017-01-01 23:00:00 ' just in case If I have datetime column on this format "yyyy-mm-dd hh:mm:ss" as timestamp column type.Literally will it works to select the date column by only write query below: Quote SELECT*FROM table WHERE date = '2017-01-01' Quote Link to comment Share on other sites More sharing options...
Lurker Posted February 3, 2017 Report Share Posted February 3, 2017 in logic, maybe no, your data have "yyyy-mm-dd hh:mm:ss" format, so you need to query in complete form or maybe using wild card, Quote Link to comment Share on other sites More sharing options...
Reyalino Posted February 5, 2017 Author Report Share Posted February 5, 2017 It works using the query below when I applied into my another table..strange!! :-D SELECT * FROM table WHERE dt::date = '2017-01-01' surf on the stack and found the query below, and it works. many thanks Lurker Quote SELECT date("date_column") FROM my_table 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.