
To insert current date/ time in MySQL, use the now() function. Let us now see an example.
At first, we will create a table. The CREATE co妹妹and is used to create a table.
mysql > create table CurrentDateTime -> ( -> CurrentTime datetime -> ); Query OK, 0 rows affected (1.14 sec)
登录后复造
Syntax to insert the current date/time with the help of insert co妹妹and and now()
mysql> insert into CurrentDateTime values(now()); Query OK, 1 row affected (0.11 sec)
登录后复造
To check that the current date/ time is inserted in the table or not, use the select co妹妹and.
mysql> select *from CurrentDateTime;
登录后复造
下列是示意咱们顺遂拔出当前日期/工夫的输入。
+---------------------+ | CurrentTime | +---------------------+ | 两018-10-18 13:14:30 | +---------------------+ 1 row in set (0.00 sec)
登录后复造
以上即是假设正在 MySQL 外拔出当前日期/光阴?的具体形式,更多请存眷萤水红IT仄台此外相闭文章!

发表评论 取消回复