MySQL SYSDATE() Usage & Examples

The SYSDATE() function in MySQL is used to return the current date and time.

Here is an example of using the SYSDATE() function:

SELECT SYSDATE();

The above example will return a result set containing the current date and time, such as: 2022-01-27 15:30:45.

You can also use the SYSDATE() function with other MySQL functions, such as DATE_FORMAT() function to format the output of dates and times. Here is an example:

SELECT DATE_FORMAT(SYSDATE(), '%Y-%m-%d %H:%i:%s') AS formatted_date;

The example above will return a formatted date and time, such as: 2022-01-27 15:30:45.

Please note that the SYSDATE() function returns the current date and time of the server, not of the client.

bannerAds