The NOW() function in MySQL returns the current date and time based on the system's time zone in the YYYY-MM-DD HH:MM:SS format. It is commonly used when you want to record the current timestamp in a query.
Example usage:
SELECT NOW();
This will return the current date and time, for example:
2024-12-23 10:15:30
You can also use it in an INSERT statement to insert the current date and time into a table.
Example:
INSERT INTO orders (order_date) VALUES (NOW());
This will insert the current date and time into the order_date field.
No comments:
Post a Comment