PHP文章按日期文章按日期(月日月日)SQL归档语句归档语句
复制代码 代码如下:
select FROM_UNIXTIME(pubtime, ‘%Y-%m’) as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime,
‘%Y-%m’)
PHP文章按日期(日)SQL归档
复制代码 代码如下:
select FROM_UNIXTIME(pubtime, ‘%Y-%m-%d’) as pubtime, count(*) as cnt from articles group by
FROM_UNIXTIME(pubtime, ‘%Y-%m-%d’)
非时间戳日期格式归档(date_format格式化日期)
复制代码 代码如下:
select date_format(`post_date`,’%Y%m%d’) as pubtime, count(*) as cnt from wp_posts where `post_status`=’publish’ group
by date_format(`post_date`,’%Y%m%d’) order by `ID` desc
select date_format(`post_date`,’%Y%m%d’) as pubtime,date_format(`post_date`,’%m 月 %d 日’) as shijian,count(*) as cnt
from wp_posts where `post_status`=’publish’ group by date_format(`post_date`,’%Y%m%d’) order by `ID` desc limit 0,7
您可能感兴趣的文章您可能感兴趣的文章:PHP中的日期加减方法示例PHP计算一年多少个星期和每周的开始和结束日期php计算两个日期时间差
(返回年、月、日)PHP输出英文时间日期的安全方法(RFC 1123格式)php格式化日期和时间格式化示例分享PHP函数之
日期时间函数date()使用详解解析php时间戳与日期的转换PHP笔记之:日期函数的使用介绍PHP以及MYSQL日期比较方法
PHP系列学习之日期函数使用介绍php格式化日期实例分析
评论0