scarhand Posted July 20, 2009 Share Posted July 20, 2009 This is not working: (the postdate field stores a time integer via the php time() function) $month = 'July'; $year = '2009'; $sql = mysql_query("select * from rss where date_format(postdate, '%M %Y')='$month $year' order by postdate desc"); Quote Link to comment https://forums.phpfreaks.com/topic/166702-solved-where-date_formatpostdate-m-ymonth-year/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 20, 2009 Share Posted July 20, 2009 DATE_FORMAT() operates on a DATE or DATETIME data type. Try the FROM_UNIXTIME(unix_timestamp,format) function with the second parameter set to '%M %Y' Quote Link to comment https://forums.phpfreaks.com/topic/166702-solved-where-date_formatpostdate-m-ymonth-year/#findComment-879020 Share on other sites More sharing options...
scarhand Posted July 20, 2009 Author Share Posted July 20, 2009 Thanks. Figured it was something like that. Quote Link to comment https://forums.phpfreaks.com/topic/166702-solved-where-date_formatpostdate-m-ymonth-year/#findComment-879036 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.