This article will assist you in how to use the CURRENT_TIMESTAMP() function to return the current timestamp.
The CURRENT_TIMESTAMP() returns the current timestamp value representing the date and time the query was executed.
ℹ️ Note that the time returned by this function is the time when the query was executed.
The precision is used to set the number of digits in the fractional seconds precision in the second field.
If you omit the precision, the CURRENT_TIMESTAMP() function will return a current timestamp that includes the complete fractional seconds precision.
⚠️ The maximum precision value that you can input is 6.
#Case 1: Current timestamp
The following example shows how to get the current date and time with a CURRENT_TIMESTAMP()function:
The final result will display the current date and time in your timezone:
#Case 2: Current timestamp with precision
Let’s assume we want to get the current timestamp but with a 2-fractional seconds precision:
The function will return the current date and time with 2 digits after seconds: