当前位置:网站首页>MySQL批量修改时间字段
MySQL批量修改时间字段
2022-08-04 05:31:00 【Louzen】
sql批量修改datetime类型的日期,不修改时间
update capturerecord set qtime=date_add(qtime,interval+1 day)
(把所有日期加一天,如:2018-08-24 11:28:59改为2018-08-25 11:28:59)
update 表名 set 时间字段=date_add(时间字段,interval+加减的天数 day)
sql批量修改时间戳,不修改时间,通过datetime类型的时间字段修改int类型的时间戳
(有datetime字段)
update capturerecord set time=unix_timestamp(qtime);
update 表名 set 时间戳字段=unix_timestamp(datetime类型字段);
SELECT FROM_UNIXTIME(capturetime, ‘%Y-%m-%d %H:%i:%S’),capturetime from platerecord
sql批量修改时间戳,不修改时间
(无datetime字段,先添加datetime字段,再通过时间戳字段修改该字段的时间)
update platerecord set time=FROM_UNIXTIME(capturetime, ‘%Y-%m-%d %H:%i:%S’);
update 表名 set datetime字段=FROM_UNIXTIME(时间戳字段, ‘%Y-%m-%d %H:%i:%S’);
time(int时间戳)qtime(datetime时间)
update capturerecord set qtime=date_add(qtime,interval-2 day)
update capturerecord set time=unix_timestamp(qtime);
capturetime(int时间戳)time(datetime时间)
SELECT FROM_UNIXTIME(capturetime, ‘%Y-%m-%d %H:%i:%S’),capturetime from platerecord
update platerecord set time=FROM_UNIXTIME(capturetime, ‘%Y-%m-%d %H:%i:%S’);
update platerecord set time=date_add(time,interval+1 day);
update platerecord set capturetime=unix_timestamp(time);
————————————————
版权声明:本文为CSDN博主「gungun_程序媛」的原创文章
原文链接:https://blog.csdn.net/weixin_43052839/article/details/82015208
边栏推荐
- 光条提取中的连通域筛除
- Copy Siege Lion 5-minute online experience MindIR format model generation
- Tencent and NetEase have taken action one after another. What is the metaverse that is so popular that it is out of the circle?
- LeetCode_Nov_1st_Week
- MNIST手写数字识别 —— 基于Mindspore快速构建感知机实现十分类
- The second official example analysis of the MOOSE platform - about creating a Kernel and solving the convection-diffusion equation
- 软著撰写注意事项
- 卷积神经网络入门详解
- Code to celebrate the Dragon Boat Festival - Zongzi, your heart
- 【论文阅读】Mining Cross-Image Semantics for Weakly Supervised Semantic Segmentation
猜你喜欢
Cut the hit pro subtitles export of essays
Brief description of database and common operation guide
迅雷关闭自动更新
剪映专业版字幕导出随笔
[Copy Siege Lion Log] Flying Pulp Academy Intensive Learning 7-Day Punch Camp-Study Notes
基于asp.net的法律援助平台的设计与实现(附项目链接)
Copy攻城狮的年度之“战”|回顾2020
Code to celebrate the Dragon Boat Festival - Zongzi, your heart
LeetCode_Dec_1st_Week
2020-03-27
随机推荐
tensorRT教程——使用tensorRT OP 搭建自己的网络
LeetCode_Nov_5th_Week
基于asp.net的法律援助平台的设计与实现(附项目链接)
Lee‘s way of Deep Learning 深度学习笔记
安装pyspider后运行pyspider all后遇到的问题
tmux概念和使用
MNIST Handwritten Digit Recognition - Building a Perceptron from Zero for Two-Classification
Brief description of database and common operation guide
LeetCode_22_Apr_2nd_Week
Deep Learning Theory - Initialization, Parameter Adjustment
Golang environment variable settings (2)--GOMODULE & GOPROXY
(导航页)OpenStack-M版-双节点手工搭建-附B站视频
2020-10-29
PCL窗口操作
基于PyTorch的FCN-8s语义分割模型搭建
MFC 打开与保存点云PCD文件
MFC读取点云,只能正常显示第一个,显示后面时报错
[CV-Learning] Linear Classifier (SVM Basics)
第三章 标准单元库(下)
arm交叉编译