Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

CURDATE() and CURRENT_TIME() in MariaDB

  • Last Updated : 20 Oct, 2020

In this article, we will discuss CURDATE and CURRENT_TIME function, and also, we will see the working of both functions with the help of an example.

1. CURDATE :
In MariaDB, The CURDATE Function is used to return the current date. In this function, no parameter will be passed. This function will return the current Date. This function works similarly to the CURDATE function. If it is used in a string context. then it will return the current date in the ‘YYYY-MM-DD’ format. If it is used in a numeric context. then it will return the current date in the YYYYMMDD format.

Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course  by GeeksforGeeks.

Syntax :

CURDATE( )

Parameters :
No parameters or arguments will be passed for the CURDATE function.



Example-1 :

SELECT CURDATE();

Output :

'2020-10-17'

Example-2 :

SELECT CURDATE() + 0;

Output :

20201017

Example-3 :

SELECT CURDATE() + 2;

Output :

20201019

2. CURRENT_TIME :
In MariaDB, The CURRENT_TIME Function is used to return the current time. In this function, no parameter will be passed. This function will return the current time. This function works similarly to the CURTIME function. If it is used in a string context. then it will return the current time in the ‘HH:MM: SS’ format. If it is used in a numeric context. then it will return the current time in the HHMMSS format.

Syntax :



CURRENT_TIME( )

Parameters :
No parameters or arguments will be passed for the CURRENT_TIME function.

Example-1 :

SELECT CURRENT_TIME();

Output :

'07:25:28'

Example-2 :

SELECT CURRENT_TIME()+4;

Output :

072532

Example-3 :

SELECT CURRENT_TIME()+0;

Output :

072528
My Personal Notes arrow_drop_up
Recommended Articles
Page :