Home > Database > Mysql Tutorial > What is the use of the MySQL FROM_UNIXTIME() function?

What is the use of the MySQL FROM_UNIXTIME() function?

WBOY
Release: 2023-09-24 08:21:02
forward
1379 people have browsed it

MySQL FROM_UNIXTIME() 函数有什么用?

MySQL FROM_UNIXTIME() function is used to return the date/datetime from the Unix timestamp version. The return value can be in the format "YYYY-MM-DD HH:MM:SS" or "YYYYMMDDHHMMSS.uuuuuu" depending on the context of the function, i.e. whether the context is a number or a string.

The following is the syntax of FROM_UNIXTIME -

FROM_UNIXTIME(unix_timestamp, [format])
Copy after login

Here unix_timestamp is the value of the Unix timestamp, and format contains the format string we want to return the value.

Example

mysql> Select FROM_UNIXTIME(1555033470);
+---------------------------+
| FROM_UNIXTIME(1555033470) |
+---------------------------+
| 2019-04-12 07:14:30       |
+---------------------------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of What is the use of the MySQL FROM_UNIXTIME() function?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template