Querying results on timestamp in mysql

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-04-30T08:50:09Z Indexed on 2010/04/30 8:57 UTC
Read the original article Hit count: 156

Filed under:
|
|
|

Hi,

I have series of records in a table called 'hits' and each record has the current_timestamp (ie. 2010-04-30 10:11:30) in a column called 'current_time'.

What I would like to do is query these records and return only the records from the current month. I cannot seem to get this to work.

I have tried a range of queries that don't work such as -

Select * FROM hits WHERE MONTH(FROM_UNIXTIME(current_time)) = 4

I don't know if I am even on the right lines!

Can anyone point me in the right direction?

Cheers.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about timestamp