我们可以作为参数传递给MySQL UNIX_TIMESTAMP函数的日期时间值的范围与TIMESTAMP数据类型的范围相同,即在“1970-01-01 00:00:01”到“2038-01-”之间19 08:44:07'。如果我们在 UNIX_TIMESTAMP 函数中给出的日期时间值超出或低于 TIMESTAMP 范围,MySQL 将返回 0 作为输出。可以借助以下示例来理解 -
mysql> select UNIX_TIMESTAMP('2038-01-19 08:44:07');
+---------------------------------------+
| UNIX_TIMESTAMP('2038-01-19 08:44:07') |
+---------------------------------------+
| 2147483647 |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> select UNIX_TIMESTAMP('2038-01-19 08:44:08');
+---------------------------------------+
| UNIX_TIMESTAMP('2038-01-19 08:44:08') |
+---------------------------------------+
| 0 |
+---------------------------------------+
1 row in set (0.00 sec)
mysql> select UNIX_TIMESTAMP('1969-01-01 05:10:00');
+---------------------------------------+
| UNIX_TIMESTAMP('1969-01-01 05:10:00') |
+---------------------------------------+
| 0 |
+---------------------------------------+
1 row in set (0.00 sec)
登录后复制
以上就是我们可以作为参数传递给 MySQL UNIX_TIMESTAMP 函数的日期时间值的范围是多少?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!