scarhand Posted December 7, 2010 Share Posted December 7, 2010 `the_date` is an integer whose value is inserted via the php time() function this code doesn't seem to work, so I imagine I am missing a function: $sql = 'SELECT SUM(`amount`) as donate_total from `donations` where MONTH(`the_date`) = MONTH(CURDATE())'; any help would be great. Link to comment https://forums.phpfreaks.com/topic/220882-using-month-with-integer-date/ Share on other sites More sharing options...
Pikachu2000 Posted December 7, 2010 Share Posted December 7, 2010 I assume you mean the value in the database is a UNIX timestamp? $sql = 'SELECT SUM(`amount`) as donate_total from `donations` where MONTH(FROM_UNIXTIME(`the_date`)) = MONTH(CURDATE())'; Link to comment https://forums.phpfreaks.com/topic/220882-using-month-with-integer-date/#findComment-1143796 Share on other sites More sharing options...
scarhand Posted December 7, 2010 Author Share Posted December 7, 2010 you rock Link to comment https://forums.phpfreaks.com/topic/220882-using-month-with-integer-date/#findComment-1143814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.