当前位置:网站首页>MySQL timestamp format conversion date format string
MySQL timestamp format conversion date format string
2022-06-24 16:07:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
1. Test table structure
CREATE TABLE `timestamp_string_change` (
`id` int NOT NULL AUTO_INCREMENT,
`up_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;2. mysql Timestamp format to string
Method 1 :
select STR_TO_DATE(tsc.up_time, '%Y-%m-%d %H:%i:%s' ) as up_time from timestamp_string_change tsc Method 2:
select from_unixtime(unix_timestamp(up_time), '%Y-%m-%d %H:%i:%s' ) as up_time from timestamp_string_change notes : Method 2 when , We need to use it first. unix_timestamp() Method to convert data to timestamp format , Reuse from_unixtime() Method to convert a timestamp to a custom format time string . Direct use from_unixtime() Method NULL.
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151936.html Link to the original text :https://javaforall.cn
边栏推荐
- Remain true to our original aspiration
- How does the effective date of SAP PP ECM affect the work order?
- Leetcode 139. Mot break word Split (medium)
- Global and Chinese markets of natural insect repellents 2022-2028: Research Report on technology, participants, trends, market size and share
- Using alicloud RDS for SQL Server Performance insight to optimize database load - first understanding of performance insight
- 用 Oasis 开发一个跳一跳(一)—— 场景搭建
- leetcode 139. Word Break 單詞拆分(中等)
- The equipment is connected to the easycvr platform through the national standard gb28181. How to solve the problem of disconnection?
- Ascinema with asciicast2gif for efficient command line terminal recording
- 微信公众号调试与Natapp环境搭建
猜你喜欢

如何扩展aws主机上的磁盘空间

日志记录真没你想的那么简单

构建Go命令行程序工具链

Nifi from introduction to practice (nanny level tutorial) - environment

用 Oasis 开发一个跳一跳(一)—— 场景搭建

Vim编辑器的最常用的用法

Three solutions for Jenkins image failing to update plug-in Center

Logging is not as simple as you think

ZOJ - 4104 sequence in the pocket

Mongodb introductory practical tutorial: learning summary directory
随机推荐
安装ImageMagick7.1库以及php的Imagick扩展
SIGGRAPH 2022 | 真实还原手部肌肉,数字人双手这次有了骨骼、肌肉、皮肤
Leetcode 139. Mot break word Split (medium)
【Prometheus】4. Monitoring cases
Installer la Bibliothèque imagemagick 7.1 et l'extension imagick de PHP
【附下载】汉化版Awvs安装与简单使用
Global and Chinese markets of stainless steel barbecue ovens 2022-2028: Research Report on technology, participants, trends, market size and share
不忘初心
My network relationship with "apifox"
Istio FAQ: failed to resolve after enabling smart DNS
Pytorch 转置卷积
Parameterized tests guide in junit5
Detailed explanation of estab of Stata regression table output
leetcode 139. Word Break 單詞拆分(中等)
转置卷积学习笔记
Using alicloud RDS for SQL Server Performance insight to optimize database load - first understanding of performance insight
mysql时间戳格式转换日期格式字符串
Global and Chinese markets of Leyte coin exchange 2022-2028: Research Report on technology, participants, trends, market size and share
The decline of China's product managers: starting from the nostalgia for jobs
Summary of common tools and usage