How to get the current date and time of MySQL?

Is there a value or command like DATETIME that I can use in manual queries 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'
)

The last quoted DATETIME value is where I want to add the current date and time.

you can use NOW():

 INSERT INTO servers (server_name, online_status, exchange, disk_space, network_shares, c_time)
VALUES('m1','ONLINE','exchange','disk_space','network_shares', NOW())

Is there a value or command like DATETIME, I can use it in 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'
)

The last quoted DATETIME value is where I want to add the current date and time.

You can use NOW():

INSERT INTO servers (server_name, online_status, exchange, disk_space, network_shares, c_time)
VALUES('m1','ONLINE','exchange','disk_space','network_shares', NOW())

Leave a Comment

Your email address will not be published.