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. Quote 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())'; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.