当前位置:网站首页>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;}边栏推荐
猜你喜欢
随机推荐
1. Introducing GEE and Geemap
Chapter 1: GEE and GEEMAP
初识C语言(1)
uniapp project construction
Codeforces Round #806 (Div. 4)||沉淀)血洗五道口
Detailed explanation of three pieces in C language
给我一个机会,帮你快速上手三子棋
网络——数字数据编码
Leading practice | How the world's largest wine app uses design sprint to innovate the vivino model
Foreword: About the author Dr. Wu Qiusheng and an introduction to the book
5. Visualizing Geospatial Data
No need to pay for the 688 Apple developer account, xcode13 packaged and exported ipa, and provided others for internal testing
Three ways to find prime numbers
ESP8266-Arduino编程实例-MQ-6异丁烷丙烷传感器驱动
【嵌入式入门篇】嵌入式0基础沉浸式刷题篇1
How to create DataFrame with feature importance from XGBClassifier made by GridSearchCV?
STM32课设-智能物联网家居系统(UCOSIII+STEMWIN)
ECCV 2022 | BMD: 面向无源领域自适应的类平衡多中心动态原型策略
前言:关于作者吴秋生博士与此书简介
4. Using Local Geospatial Data







