Answer the question
In order to leave comments, you need to log in
Create a query to search by month?
Help me write a query to find values by month.
There is a table with a list of news. The date column stores the time when the record was added in UNIX (TIMESTAMP) .
How to search directly in the query to select those news that were posted for 9 months (in September)?
Answer the question
In order to leave comments, you need to log in
SELECT * FROM table WHERE YEAR(FROM_UNIXTIME(`date`))='2015' AND MONTH(FROM_UNIXTIME(`date`))='9';
September 1, 2015 0:0:0 - 1441065600
October 1, 2015 0:0:0 - 1443657600
elementary logic suggests: date >= 1441065600 and date <
1443657600 or corresponding functions in your programming language?
www.cy-pr.com/tools/time here is the first one I found
SELECT * FROM table where date BETWEEN UNIX_TIMESTAMP('2015-09-01 00:00:00') AND UNIX_TIMESTAMP('2015-09-30 29:59:59')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question