0

I have a table with a few records and for each of these records I've also added a UNIX_TIMESTAMP. Now, I also have a search engine for those records in which I can choose a date using a jQuery datapicker. My question is how do I make the request so that to select all timestamps from the database for a certain date.

Jessie Stalk
  • 951
  • 3
  • 10
  • 15

3 Answers3

2

With an index on your timestamp column you will get a faster result with:

SELECT *
  FROM table_name
 WHERE time_stamp_column_name >= :date_picked
   AND time_stamp_column_name <  :date_picked + INTERVAL 1 DAY

Where :date_picked is your bound-in picked date as a string in the format 'YYYY-MM-DD'.

Arth
  • 12,789
  • 5
  • 37
  • 69
1

You can use from_unixtime to convert it into a date

select *
from 
  table
where
date(from_unixtime(your_timestamp_col)) = '2014-10-01'
M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118
0

use unix timestamp you can also see this

Community
  • 1
  • 1
codinglazy
  • 13
  • 4