silvercover Posted August 28, 2009 Share Posted August 28, 2009 Hi, I have list of items in my database with date field in UNIX time stamp format. now I need to: 1- show items sorted and grouped by the month they've been entered into my database. example: ---- January ---- Item 1 Item 2 Item 3 ---- February ---- Item 4 Item 5 Item 6 Item 7 2- show items have entered in current month. example: ---- Current Month Items ---- Item 1 Item 2 Item 3 Item 4 how can I do that? Thanks in Advance. Link to comment https://forums.phpfreaks.com/topic/172240-solved-order-list-by-month-questions/ Share on other sites More sharing options...
ignace Posted August 28, 2009 Share Posted August 28, 2009 1. ORDER BY month(timestamp) 2. WHERE month(now()) = month(timestamp) Link to comment https://forums.phpfreaks.com/topic/172240-solved-order-list-by-month-questions/#findComment-908168 Share on other sites More sharing options...
silvercover Posted August 28, 2009 Author Share Posted August 28, 2009 Thanks ignace for your tips. I figured that I have to use this to get it work properly: WHERE month(FROM_UNIXTIME(timestamp_field)) = month(now()) Link to comment https://forums.phpfreaks.com/topic/172240-solved-order-list-by-month-questions/#findComment-908238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.