1

MySQL now() returns 0 value for month,date,hour,minute and second but year value is correct. The problem is same with the sysdate(), current_timestamp() also. While current_date() and current_time() returns the correct values.

mysql-sql> select now();
+--------------------+
| now()              |
+--------------------+
| 2018-00-00 0:00:00 |
+--------------------+
1 row in set (0.00 sec)
mysql-sql> select sysdate();
+--------------------+
| sysdate()          |
+--------------------+
| 2018-00-00 0:00:00 |
+--------------------+
1 row in set (0.00 sec)
mysql-sql> select current_timestamp;
+--------------------+
| current_timestamp  |
+--------------------+
| 2018-00-00 0:00:00 |
+--------------------+
1 row in set (0.00 sec)
mysql-sql> select current_date();
+----------------+
| current_date() |
+----------------+
| 2018-09-21     |
+----------------+
1 row in set (0.04 sec)
mysql-sql> select current_time();
+----------------+
| current_time() |
+----------------+
| 22:08:47       |
+----------------+
1 row in set (0.00 sec)

I'm Using MySQL 5.7 in Windows 10.0.17134.167. System timezone is IST (+5.30)

mysql-sql> SELECT NOW(), @@global.time_zone AS gtz, @@session.time_zone AS stz;
+--------------------+--------+--------+
| NOW()              | gtz    | stz    |
+--------------------+--------+--------+
| 2018-00-00 0:00:00 | +05:30 | +05:30 |
+--------------------+--------+--------+
1 row in set (0.00 sec)

0 Answers0