Open In App

MAKETIME () and MICROSECOND () in MariaDB

Last Updated : 10 Nov, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

MAKETIME Function :
In MariaDB, MAKETIME Function is used to returns the time for a certain hour, minute, the second combination. In this function, the first parameter will be an hour, the second parameter will be minute and third will be second. This function will return the combination of the hour, minute and second. Time values range from ‘-838:59:59’ to ‘838:59:59’.

Syntax :

MAKETIME( hour, minute, second )

Parameter :

Parameter Description
hour The hour value which will be used to create the time.
minute The minute value which will be used to create the time.
second The second value which will be used to create the time.

Return :
It will return the time for a certain hour, minute, the second combination.

Example –

SELECT MAKETIME(9, 49, 15);

Output :

'09:49:15'

Example –

SELECT MAKETIME(23, 59, 59);

Output :

'23:59:59'

Example –

SELECT MAKETIME(-838, 59, 59);

Output :

'-838:59:59'

MICROSECOND Function :
In MariaDB, The Microsecond Function is used to return the microsecond portion of a date value. In this function, the first parameter will be date_value. This function will return returns the microsecond portion of a date value. This function returns the microsecond portion (a number from 0 to 999999) given a date value.

Syntax :

MICROSECOND( date_value )

Parameters –

Parameters Description
date_value A time or datetime value from which to extract the microsecond.

Return :
microsecond

Example –

SELECT MICROSECOND('2017-01-29 03:22:05.000001');

Output :

1

Example –

SELECT MICROSECOND('2017-07-15');

Output :

0

Example –

SELECT MICROSECOND('10:16:06.294675');

Output :

294675

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads