获取月份
(推荐教程:mysql教程)
SELECT * FROM BLOG WHERE MONTH(CREATETIME)=7;
获取年份
SELECT * FROM BLOG WHERE YEAR(CREATETIME)=7;