Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Now() and MonthName() in MariaDB

  • Last Updated : 12 Nov, 2020

1. Now() Function :

In MariaDB, Now Function has used to returns the current date and time. In this function, No parameter will be passed. For the string context the current date as a ‘YYYY-MM-DD HH:MM: SS’ format and For the numeric context the current date as a YYYYMMDDHHMMSS format will return by this function. It works similar to CURRENT_TIMESTAMP, LOCALTIME, and LOCALTIMESTAMP functions.

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

Syntax :

NOW()

Parameter :



ParameterDescription
NoneNo Parameter will be passed in this function

Return :

Returns the current date and time.

Example-1 :

SELECT NOW();

Output :

'2020-11-07 07:59:41'

Example-2 :

SELECT NOW() + 10;

Output :

20201107075951

Example-3 :

SELECT NOW() -15;

Output :



20201107075926

2. MonthName() function :

In MariaDB, The MonthName Function is used to return the full name of the month for a date. In this function, the first parameter will be date_value. This function will return returns the full name of the month from a date value. This function returns the full name of the month (January, February, … December) given a date value.

Syntax :

 MONTHNAME( date_value )

Parameters :

ParametersDescription
date_valueA time or DateTime value from which to extract the month name.

Return :

 The name of the month portion from date.

Example-1 :

SELECT MONTHNAME('2018-03-19 09:22:05.999999')

Output :

March

Example-2 :

SELECT MONTHNAME('2020-06-01');

Output :

June

Example-3 :

The curtime() function returns the current time of the system. Today is 07-11-2020 and current month is November

SELECT MONTHNAME(CURTIME());

Output :

November
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!