Home  >  Article  >  Database  >  How to return datetime value in numeric format using MySQL FROM_UNIXTIME() function?

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

WBOY
WBOYforward
2023-08-25 11:49:04587browse

如何使用 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)

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete