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

How to convert timestamps from mysql time

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to convert mysql time stamp". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Mysql time conversion timestamp method: 1, through "SELECT NOW ();" to obtain the current time; 2, through "SELECT UNIX_TIMESTAMP (NOW ());" time and date format can be converted to timestamp format.

The operating environment of this paper: Windows7 system, mysql8, Dell G3.

How to convert the timestamp of mysql time?

Conversion between MySQL timestamp and date format

The conversion between MySQL timestamp and date format, and the conversion between PHP timestamp and date format

MySQL:

Get the current time

SELECT NOW () / 14:22:51 on 2018-10-11

Time and date format is converted to timestamp format, UNIX_TIMESTAMP ()

SELECT UNIX_TIMESTAMP (NOW ()); / / 1539238930

Convert timestamp format to time and date format, FROM_UNIXTIME ()

SELECT FROM_UNIXTIME (1539238971); / / 14:22:51 on 2018-10-11

PHP:

Get the current timestamp

Time (); / / 1539238975

Convert timestamp format to time and date format

Date ('Y-m-d time ()); / / 2018-10-11 14:24:06

Convert time and date format to timestamp format

This is the end of the introduction of strtotime ('2018-10-11 14-14-24 06'); / 1539239046 "how to convert mysql time to timestamp". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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