Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
On passing an out-of-range value in UNIX_TIMESTAMP() or FROM_UNIXTIME() function, what MySQL will return?
When we pass an out-of-range value in UNIX_TIMESTAMP, MySQL returns 0. The valid range of value is same as for the TIMESTAMP data type.
Example
mysql> Select UNIX_TIMESTAMP('1969-01-01 04:05:45');
+---------------------------------------+
| UNIX_TIMESTAMP('1969-01-01 04:05:45') |
+---------------------------------------+
| 0 |
+---------------------------------------+
1 row in set (0.00 sec)
When we pass an out-of-range value in FROM_UNIXTIME, MySQL returns NULL. The valid range of values is same as for the INTEGER data type.
Example
mysql> Select FROM_UNIXTIME(2147483648); +---------------------------+ | FROM_UNIXTIME(2147483648) | +---------------------------+ | NULL | +---------------------------+ 1 row in set (0.00 sec)
Advertisements
