当前位置:网站首页>MySQL date timestamp conversion
MySQL date timestamp conversion
2022-06-24 16:07:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
1.MySQL Get the current timestamp
MySQL> select UNIX_TIMESTAMP();
+------------------+
| UNIX_TIMESTAMP() |
+------------------+
| 1525739078 |
+------------------+
1 row in set
MySQL> SELECT UNIX_TIMESTAMP(NOW());
+-----------------------+
| UNIX_TIMESTAMP(NOW()) |
+-----------------------+
| 1525739117 |
+-----------------------+
1 row in set
These two are equivalent
2.MySQL Date to timestamp
The date conversion timestamp is also used above 1 The function used
mysql> SELECT UNIX_TIMESTAMP('2018-05-08 08:26:30');
+---------------------------------------+
| UNIX_TIMESTAMP('2018-05-08 08:26:30') |
+---------------------------------------+
| 1525739190 |
+---------------------------------------+
1 row in set
1 Medium now() function , Returns the long date of the current time , and 2018-05-08 08:26:30 Same format
3. Time stamp converted to date
select FROM_UNIXTIME(1525740032);
+---------------------------+
| FROM_UNIXTIME(1525740032) |
+---------------------------+
| 2018-05-08 08:40:32 |
+---------------------------+
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151933.html Link to the original text :https://javaforall.cn
边栏推荐
- C. Three displays(动态规划)Codeforces Round #485 (Div. 2)
- 日志记录真没你想的那么简单
- I just came back from the Ali software test. I worked for Alibaba P7 in 3+1, with an annual salary of 28*15
- Remain true to our original aspiration
- 2021-04-22: given many line segments, each line segment has two numbers [start, end],
- Istio FAQ: failed to resolve after enabling smart DNS
- [interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction
- 对深度可分离卷积、分组卷积、扩张卷积、转置卷积(反卷积)的理解
- The decline of China's product managers: starting from the nostalgia for jobs
- MySQL Advanced Series: Locks - Locks in InnoDB
猜你喜欢
【云原生 | Kubernetes篇】Kubernetes基础入门(三)
A new weapon to break the memory wall has become a "hot search" in the industry! Persistent memory enables workers to play with massive data + high-dimensional models
The penetration of 5g users of operators is far slower than that of 4G. The popularity of 5g still depends on China Radio and television
如何轻松实现在线K歌房,与王心凌合唱《山海》
Mongodb Getting started Practical Tutoriel: Learning Summary Table des matières
Why is it easy for enterprises to fail in implementing WMS warehouse management system
Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)
Cap: multiple attention mechanism, interesting fine-grained classification scheme | AAAI 2021
Siggraph 2022 | truly restore the hand muscles. This time, the digital human hands have bones, muscles and skin
Build go command line program tool chain
随机推荐
Global and Chinese markets of Leyte coin exchange 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market for commercial barbecue smokers 2022-2028: Research Report on technology, participants, trends, market size and share
Flink kubernetes application deployment
Pytorch 转置卷积
Database tools in intelij can connect but cannot display schema, tables
安装ImageMagick7.1库以及php的Imagick扩展
Convert text to hexadecimal, and reverse
Parameterized tests guide in junit5
【Prometheus】4. Monitoring cases
Summary of common tools and usage
转置卷积详解
转置卷积学习笔记
Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)
Wechat official account debugging and natapp environment building
用 Oasis 开发一个跳一跳(一)—— 场景搭建
Global and Chinese market of training dance clothes 2022-2028: Research Report on technology, participants, trends, market size and share
打破内存墙的新利器成行业“热搜”!持久内存让打工人也能玩转海量数据+高维模型
Easy installation of Jenkins
C. Three displays(动态规划)Codeforces Round #485 (Div. 2)
[C language questions -- leetcode 12 questions] take you off and fly into the garbage