当前位置:网站首页>PHP completes missing dates in date ranges/returns missing dates
PHP completes missing dates in date ranges/returns missing dates
2022-08-09 18:06:00 【withoutfear】
query("SELECT id, date FROM `table_name` WHERE `areaname` = 'xxx'");while ($r = $db->fetch_array($result)) {$list[] = $r['date'];$lists[] = $r;}# complete date$newData = spd('2012-01-01', '2013-08-08');# missing date$difference_set_arr = array_diff($newData, $list);echo '';var_dump("'" . implode("','", $difference_set_arr) . "'");die;function spd($minimum_time, $maximum_time){# Date must use string type because date is not a numeric type$collection = [];// loop calculation$minimum_time = strtotime($minimum_time);$maximum_time = strtotime($maximum_time);while ($minimum_time <= $maximum_time) {$collection[] += $minimum_time;$minimum_time = strtotime('+1 day', $minimum_time);}foreach ($collection as &$value) {$value = date('Y-m-d', $value);}return $collection;}边栏推荐
- 2022-08-09日报:做学术OR去公司 ? 想通这点,治好 AI 打工人的精神内耗
- 网络——虚拟专用网和地址转换NAT
- C语言小游戏——三子棋
- uni-app中websocket的使用 断开重连、心跳机制
- C语言小游戏—扫雷
- Anatomy of Storage Size, Value Range, and Output Format of Basic Data Types in C Language
- 1. Introducing GEE and Geemap
- 【Chinese and English Catalog】Introduction
- The first day of the real in CSDN
- 前言:关于作者吴秋生博士与此书简介
猜你喜欢
随机推荐
网络——数字数据编码
良匠-手把手教你写NFT抢购软(二)
C语言的常量和操作符
map和set容器
MySQL进阶学习
Volatile:JVM 我警告你,我的人你别乱动
0. About The Author And Preface
2022年深圳杯数学建模A题代码思路-- 破除“尖叫效应”与“回声室效应”,走出“信息茧房”
第三章:GEE数据的使用(3.1-3.3)
第二章:创建交互式地图(2.4-2.6)
Smart Light Pole Gateway Smart Transportation Application
Codeforces Round #808 (Div. 2)||Precipitation
网络——IPV4地址(三)
五.初始指针
【Chinese and English Catalog】Introduction
SQL抖音面试题:送你一个万能模板,要吗?(重点、每个用户每月连续登录的最大天数)
Codeforces Round # 806 (Div. 4) | | precipitation) bloodbath wudaokou
【挨踢(IT)初体验】
给我一个机会,帮你快速上手三子棋
第二章:创建交互式地图(2.1-2.3)









