How to get the current date and time in MySQL?
SELECT NOW(), CURDATE(), CURTIME();
NOW() returns something like 2025-01-15 10:30:00, CURDATE() returns 2025-01-15 and CURTIME() returns 10:30:00. The values change every second. Use DEFAULT CURRENT_TIMESTAMP to save the creation time of a row. See Date Functions.
Learn more about the similar topics:
| Tutorials |
|---|
| MySQL String Functions |
| MySQL Date Functions |
| Exercises & Assignments |
|---|
| Write a query to fetch the names of the students in upper case |
| Write a query to retrieve the first four characters of the name |
| Interview Questions & Answers |
|---|
| Write a query to retrieve the first four characters of name from the student table |
| How to get the current date and time in MySQL? |