Home > Database > Mysql Tutorial > body text

How to return datetime value in numeric format using MySQL FROM_UNIXTIME() function?

WBOY
Release: 2023-08-25 11:49:04
forward
645 people have browsed it

如何使用 MySQL FROM_UNIXTIME() 函数以数字格式返回日期时间值?

As we all know, we can convert the time of a datetime value into an integer by adding 0( 0). In a similar way, we can convert the datetime value returned by FROM_UNIXTIME() function into numeric format. The following example will illustrate this more clearly -

mysql> Select FROM_UNIXTIME(1555033470)+0 AS 'Date in Numeric Format';
+------------------------+
| Date in Numeric Format |
+------------------------+
| 20190412071430.000000  |
+------------------------+
1 row in set (0.00 sec)
Copy after login

After adding 0 (0) to the datetime value, MySQL returns a value with up to 6 microseconds.

The above is the detailed content of How to return datetime value in numeric format using 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