How to select UNIX date = “2010” in mysql query?
Here is my code so far:
SELECT `date`, title, category, url FROM cute_news WHERE category = '4' ORDER BY `date` DESC
I want make pages based on the year, like, 2010 , 2009, 2008 and so on. The database saves the date as UNIX_Timestamp. Not sure how to query a recordset with a Year parameter?
WHERE unix_timestamp(YEAR) = '2010' or something???
Thanks in advance. I'm baffled.
You'll want something like
WHERE YEAR(FROM_UNIXTIME(date_field)) = 2010.
- A Linux, Apache, MySQL, PHP (LAMP) stack is a combination of open source software that is typically installed together to enable a server to host dynamic […]
- MySQL is an the most popular open-source database management system, in most of hosting company its has been bundle by LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. Another alternative […]
- MySQL is the world’s most popular open-source database. Despite its powerful features, MySQL is simple to set up and easy to use. Below are some instructions […]