Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of converting timestamp to date by mysql

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the method of converting timestamps to dates by mysql. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Mysql converts timestamps to dates by using the function [FROM_UNIXTIME ()] and the code is [select FROM_UNIXTIME (1429063399)% Y% m / d')].

How mysql converts a timestamp to a date:

1. Time stamp is converted to date

Function: FROM_UNIXTIME ()

Select FROM_UNIXTIME (1429063399)% Y% m / d')

The result is: April 15, 2015

2. Convert the date to a timestamp, which is the opposite of FROM_UNIXTIME

Function: UNIX_TIMESTAMP ()

Select UNIX_TIMESTAMP ('2015-04-15')

The result is: 1429027200

So much for sharing mysql's method of converting timestamps into dates. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report