MySQL NOW() Function: Usage Guide

The NOW() function in MySQL is used to retrieve the current date and time. It returns a string containing the current date and time in the format ‘YYYY-MM-DD HH:MM:SS’. For example, you can use the NOW() function in INSERT or UPDATE statements to automatically insert or update the current date and time in the respective columns of a table. An example is shown below:

INSERT INTO my_table (created_at) VALUES (NOW());

This will insert the current date and time in the created_at column of the my_table table.

bannerAds