PHP文章按日期(月日)SQL归档语句

yipeiwu_com5年前PHP代码库
复制代码 代码如下:

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使用PDO操作sqlite数据库应用案例

本文实例讲述了PHP使用PDO操作sqlite数据库。分享给大家供大家参考,具体如下: 1、需求: 已知: 1)、一个json文件,里面是一个二维数组,数组解析出来为: array...

php从数组中随机抽取一些元素的代码

复制代码 代码如下: <?php class getValues { public function inputValue($inputArray) { $this->inp...

php 批量添加多行文本框textarea一行一个

复制代码 代码如下: $act=!empty($_GET['act']) ? trim($_GET['act']) : ''; switch($act) { case 'adda': $...

详解PHP错误日志的获取方法

在PHP中错误日志的获取方法有很多种,下面我给大家简单介绍下遇到此类问题如何解决,下面通过代码给大家展示下,希望能够帮助到大家。 <?php error_reporti...

PHP开发框架laravel安装与配置教程

Laravel是一套简洁、优雅的PHP Web开发框架,本文将详细介绍Laravel如何进行配置 配置说明 框架下载好了,但是想要很好的使用,可能我们还有一些东西需要知道,这就是配置。和...