本文介绍了MySQL - 插入当前日期/时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有像DATETIME这样的值或命令,我可以在手动查询中使用来插入当前的日期和时间?
Is there a value or command like DATETIME that I can use in a manual query to insert the current date and time?
INSERT INTO servers (server_name, online_status, exchange, disk_space, network_shares) VALUES('m1', 'ONLINE', 'ONLINE', '100GB', 'ONLINE' 'DATETIME' )
最后引用的DATETIME值是我想添加当前的日期和时间。
The quoted DATETIME value at the end is where I want to add the current date and time.
推荐答案
可以使用 NOW() code>
You can use
NOW()
:
INSERT INTO servers (server_name, online_status, exchange, disk_space, network_shares)
VALUES('m1', 'ONLINE', 'exchange', 'disk_space', 'network_shares', NOW())
这篇关于MySQL - 插入当前日期/时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!