Sunday, December 22, 2024

MySQL CURRENT_DATE()

 In MySQL, the function CURRENT_DATE() returns the current date in the YYYY-MM-DD format, based on the server's system date.

Syntax:

CURRENT_DATE()

Alternatively, you can also use the alias CURDATE() for the same functionality.

Example:

SELECT CURRENT_DATE();

This will return the current date, like:

2024-12-23

Notes:

  • It only returns the date, not the time. If you need both date and time, you can use CURRENT_TIMESTAMP() or NOW().
  • The result depends on the timezone set on the MySQL server.

No comments:

Post a Comment