mysql数据库 now()
返回月、日、时、分和秒的0值,但年值是正确的。这个问题和 sysdate()
, current_timestamp()
也。而 current_date()
以及 current_time()
返回正确的值。
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)
我正在Windows10.0.17134.167中使用MySQL5.7。系统时区为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)
暂无答案!
目前还没有任何答案,快来回答吧!