当前位置:网站首页>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
边栏推荐
- Still worried about missing measurements? Let's use Jacobo to calculate the code coverage
- 2021-04-29: given an array arr, it represents a row of balloons with scores. One for each blow
- Cap: multiple attention mechanism, interesting fine-grained classification scheme | AAAI 2021
- Here comes Wi Fi 7. How strong is it?
- How does the effective date of SAP PP ECM affect the work order?
- 2021-04-25: given an array arr and a positive number m, the
- Implement Domain Driven Design - use ABP framework - domain logic & application logic
- 期货怎么开户安全些?哪些期货公司靠谱些?
- Several common DoS attacks
- Fastjson 漏洞利用技巧
猜你喜欢

How to easily realize online karaoke room and sing "mountain sea" with Wang Xinling

C. K-th Not Divisible by n(数学+思维) Codeforces Round #640 (Div. 4)

一文详解JackSon配置信息

ZOJ——4104 Sequence in the Pocket(思维问题)

Database tools in intelij can connect but cannot display schema, tables

【面试高频题】难度 3/5,可直接构造的序列 DP 题

一文理解OpenStack网络

实现领域驱动设计 - 使用ABP框架 - 领域逻辑 & 应用逻辑

存在安全隐患 路虎召回部分混动揽运

Mongodb introductory practical tutorial: learning summary directory
随机推荐
The first in China! Tencent cloud key management system passes password application verification test
如何轻松实现在线K歌房,与王心凌合唱《山海》
Most common usage of vim editor
B. Terry sequence (thinking + greed) codeforces round 665 (Div. 2)
Flink kubernetes application deployment
Apple is no match for the longest selling mobile phone made in China, and has finally brought back the face of the domestic mobile phone
转置卷积详解
SIGGRAPH 2022 | 真实还原手部肌肉,数字人双手这次有了骨骼、肌肉、皮肤
对深度可分离卷积、分组卷积、扩张卷积、转置卷积(反卷积)的理解
HMM to CRF understanding and learning notes
Here comes Wi Fi 7. How strong is it?
2021-04-18: given a two-dimensional array matrix, the value in it is either 1 or 0,
Global and Chinese markets of natural insect repellents 2022-2028: Research Report on technology, participants, trends, market size and share
Install the imagemagick7.1 library and the imageick extension for PHP
60 个神级 VS Code 插件!!
Three solutions for Jenkins image failing to update plug-in Center
中国产品经理的没落:从怀恋乔布斯开始谈起
Using oasis to develop a hop by hop (I) -- Scene Building
Detailed explanation of estab of Stata regression table output
Leetcode 139. Mot break word Split (medium)