t_machine Posted April 25, 2006 Share Posted April 25, 2006 hi, I am wondering if anyone can help me with this date problem. I have a database that stores username and date(unix timestamp). I would however like to list all the usernames within the current month. Something like this would be great.$thismonth = date('m,Y', time()); // 04,2006"SELECT username FROM TABLENAME WHERE date_added ='$thismonth'how can i strip the 'date_added' which is in timestamp to month and year so I could compare and list the users within that month. Thanks :) Link to comment https://forums.phpfreaks.com/topic/8392-how-to-compare-dates-in-mysql-query/ Share on other sites More sharing options...
Barand Posted April 25, 2006 Share Posted April 25, 2006 [code].... WHERE DATE_FORMAT(FROM_UNIXTIME(date_added), '%m,%Y') = '$thismonth'[/code] Link to comment https://forums.phpfreaks.com/topic/8392-how-to-compare-dates-in-mysql-query/#findComment-30769 Share on other sites More sharing options...
t_machine Posted April 26, 2006 Author Share Posted April 26, 2006 Thank you very much :) This works great! Link to comment https://forums.phpfreaks.com/topic/8392-how-to-compare-dates-in-mysql-query/#findComment-30972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.