MySQL sysdate() function; In this tutorial, i am going to show you MySQL sysdate() function with the help of it’s syntax, parameters and examples.
MySQL SYSDATE() function
The MySQL SYSDATE function returns the current date and time.
Syntax of MySQL SYSDATE() function
SYSDATE(argument)
argument:- It is an optional parameter. It specifies the fractional seconds precision for the return value.
Example 1 – MySQL SYSDATE() function
Let’s take an example using MySQL sytdate() function; as follows:
SELECT SYSDATE();
The output of the above query is the following:
+---------------------+ | SYSDATE() | +---------------------+ | 2020-01-04 11:18:09 | +---------------------+
Example 2 – MySQL SYSDATE() function With Fractional Seconds
Let’s take an second example using mysql sysdate() with fractional seconds precision; as follows:
SELECT SYSDATE(8);
The output of the above query is the following:
+----------------------------+ | SYSDATE(4) | +----------------------------+ | 2020-01-04 11:19:45.9179 | +----------------------------+
Example 3 – MySQL SYSDATE() function With Numeric Context
Let’s take an example using MySQL sysdate() with a numeric context; as follows:
SELECT SYSDATE() + 1;
You can also add in mysql sysdate() +1, sysdate() +7, sysdate() +15, sysdate() +30, etc.
The output of the above query is the following:
+----------------------------+ | SYSDATE() + 1 | +----------------------------+ | 20200104112060 | +----------------------------+
Conclusion
MySQL sysdate() function; In this tutorial, You have learned MySQL sysdate() function with the help of it’s syntax, parameters and examples.