Open In App

Now() and MonthName() in MariaDB

Improve
Improve
Like Article
Like
Save
Share
Report

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.

Syntax :

NOW()

Parameter :

Parameter Description
None No 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 :

Parameters Description
date_value A 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

Last Updated : 12 Nov, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads