当前位置:网站首页>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;}边栏推荐
- CompletableFuture异步线程优化代码
- How to create DataFrame with feature importance from XGBClassifier made by GridSearchCV?
- Excel相关处理工具类
- ESP8266-Arduino编程实例-MQ-5液化天然气传感器驱动
- 2022-08-09日报:做学术OR去公司 ? 想通这点,治好 AI 打工人的精神内耗
- Foreword: About the author Dr. Wu Qiusheng and an introduction to the book
- uniapp project construction
- map和set容器
- 经典题型(一)
- character rhombus code
猜你喜欢
随机推荐
4. Using Local Geospatial Data
Md5加密方法
Base64工具类
经典题型(一)
3. Using Earth Engine Data
第一章:GEE 和 GEEMAP
网络——介质访问控制
第三章:GEE数据的使用(3.1-3.3)
No need to pay for the 688 Apple developer account, xcode13 packaged and exported ipa, and provided others for internal testing
Super hot summer air conditioner
领先实践|全球最大红酒App如何用设计冲刺创新vivino模式
【Chinese and English Catalog】Introduction
ESP8266-Arduino编程实例-MQ-5液化天然气传感器驱动
无需支付688苹果开发者账号,xcode13打包导出ipa,提供他人进行内测
时间日期格式工具类
The first day of the real in CSDN
Nacos Jaspyt配置加密设置
map和set容器
C语言分支语句if,switch语句详细讲解
【科普】关于平板电脑的那些事









