当前位置:网站首页>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
边栏推荐
- MNIST Handwritten Digit Recognition - From Perceptrons to Convolutional Neural Networks
- 安装MySQL的详细步骤
- MNIST手写数字识别 —— 基于Mindspore快速构建感知机实现十分类
- Rules.make-适合在编辑模式下看
- 集合--LinkedList
- ConnectionRefusedError: [Errno 111] Connection refused问题解决
- MOOSE平台官方第二个例子分析——关于创建Kernel,求解对流扩散方程
- AWS使用EC2降低DeepRacer的训练成本:DeepRacer-for-cloud的实践操作
- MNIST Handwritten Digit Recognition - Image Analysis Method for Binary Classification
- Pytorch语义分割理解
猜你喜欢
随机推荐
Pytorch语义分割理解
Copy Siege Lion's Annual "Battle" | Review 2020
安装pyspider后运行pyspider all后遇到的问题
彻底删除MySQL教程
Deep Learning Theory - Overfitting, Underfitting, Regularization, Optimizers
AWS uses EC2 to reduce the training cost of DeepRacer: DeepRacer-for-cloud practical operation
TensorRT 5 初步认识
Code to celebrate the Dragon Boat Festival - Zongzi, your heart
LeetCode_22_Apr_2nd_Week
审稿意见回复
Qt日常学习
MOOSE平台官方第二个例子分析——关于创建Kernel,求解对流扩散方程
软著撰写注意事项
【论文阅读】TransReID: Transformer-based Object Re-Identification
卷积神经网络入门详解
Deep learning, "grain and grass" first--On the way to obtain data sets
Brief description of database and common operation guide
PCL1.12 解决memory.h中EIGEN处中断问题
深度确定性策略梯度(DDPG)
[CV-Learning] Linear Classifier (SVM Basics)