当前位置:网站首页>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;}
边栏推荐
- 第二章:创建交互式地图(2.1-2.3)
- The use of websocket in uni-app Disconnection, reconnection, heartbeat mechanism
- 网络——IPV4地址(二)
- 【Chinese and English Catalog】Introduction
- C语言扫雷
- 苹果开发者账号 申请 D-U-N-S 编号
- map和set容器
- 第四章:使用本地地理空间数据(4.1-4.5)
- 网络——数据交换方式
- No need to pay for the 688 Apple developer account, xcode13 packaged and exported ipa, and provided others for internal testing
猜你喜欢
Swagger2 knife4j NullPointerException 空指针问题
自定义过滤器和拦截器实现ThreadLocal线程封闭
网络——TCP拥塞控制
Anatomy of Storage Size, Value Range, and Output Format of Basic Data Types in C Language
测试工作管理与规范
一个程序员的水平能差到什么程度?
巧用Prometheus来扩展kubernetes调度器
Nacos注册中心 Feign远程调用 Gateway服务网关
IDEA中操作数据库 以MySQL为例,可以放弃Navicat了
C语言分支语句if,switch语句详细讲解
随机推荐
易基因|作物育种:DNA甲基化在大豆优良品种培育中的作用研究成果
Access Characteristics of Constructor under Inheritance Relationship
C语言扫雷
Excel相关处理工具类
resubmit 渐进式防重复提交框架简介
第四章:使用本地地理空间数据(4.1-4.5)
分布式恢复【进阶篇】
三.两数交换 空指针 && 野指针 解引用问题
网络——彻底搞懂数据时延的相关计算
The use of websocket in uni-app Disconnection, reconnection, heartbeat mechanism
Chapter 4: Using Local Geospatial Data (4.6-4.14)
Codeforces Round # 806 (Div. 4) | | precipitation) bloodbath wudaokou
【完美解决v-if导致echart不显示问题】
【Web渗透】信息收集篇——Google搜索引擎(二)
#yyds干货盘点# 面试必刷TOP101:删除有序链表中重复的元素-II
C语言的常量和操作符
【挨踢(IT)初体验】
Codeforces Round #808 (Div. 2)||Precipitation
Nacos注册中心 Feign远程调用 Gateway服务网关
Apple Developer Account Apply for D-U-N-S Number