SECOND Function and SYSDATE Function in MariaDB
Last Updated :
27 Nov, 2020
1. SECOND Function :
In MariaDB, The SECOND Function returns the second portion of a date value. In this function, the first parameter will be the date/DateTime. This function returns the seconds (a number from 0 to 59) given a date value. In this function, we will pass the date value in it and it will return the second of the date as result.
Syntax :
SECOND( date_value )
Parameter:
- date_value - A date or DateTime value from which to extract the second.
Return :
It will return the second portion of a date value.
Example-1:
SELECT SECOND('10:06:23')-SECOND('2020-05-19 09:19:02.000004');
Output:
21
Example-2:
SELECT SECOND('01:02:22')+SECOND('02:10:06');
Output:
28
Example-3:
SELECT SECOND('14:01:26');
Output:
26
Example-4:
SELECT SECOND('2020-05-19 09:19:02.000004');
Output:
2
Example-5:
SELECT SECOND('2018-10-11 12:20:23');
Output:
23
Example-6:
SELECT SECOND('838:10:59');
Output:
59
Example-7:
#The Curdate() function will return the current time of the system date
SELECT SECOND(CURDATE());
Output:
19
2. SYSDATE Function :
In MariaDB, The SYSDATE Function is used to return the current date and time. In this function, No parameter will be passed. For the string context, this function will return the current date as a 'YYYY-MM-DD HH:MM: SS' format. And for the numeric context, this function will return the current date as a YYYYMMDDHHMMSS format.
Syntax:
SYSDATE()
Parameter:
- NA - No parameter will be passed in this function.
Return:
Return the current date and time
Example-1:
SELECT (SYSDATE()+12)-SYSDATE();
Output:
12
Example-2:
SELECT SYSDATE();
Output:
'2020-11-08 10:27:21'
Example-3:
SELECT SYSDATE() + 10;
Output:
20201108102731
Example-4:
SELECT SYSDATE() - 15;
Output:
20201108102706
Similar Reads
TO_DAYS Function and WEEK Function in MariaDB TO_DAYS Function : In MariaDB, TO_DAYS Function converts a date into numeric days. In this function, the first parameter will be the Date. This function returns the numeric days of the date. This function is to be used only with dates within the Gregorian calendar. This function will return NULL if
2 min read
WEEKDAY Function and WEEKOFYEAR Function in MariaDB 1. WEEKDAY Function : In MariaDB, The Weekday Function returns the weekday index for a date. In this function, the first parameter will be the Date value. This function returns the weekday index for a date. In WEEKDAY function returns the index value of the weekday given a date value. It works oppos
2 min read
Sin(), Cos() and Tan() Function in MariaDB 1. Sin() Function : In MariaDB, SIN() function is used to returns the sine of a number. In this function, a number will be passed as a parameter and this function will return the sine of that number. The number used to calculate the sine. It is expressed in radians. Syntax : SIN(number) Parameter :
2 min read
SLN() and SYD() Function Function in MS Access 1. SLN() Function : SLN() Function in MS Access is used to calculate the straight-line depreciation of an asset for a single period. Syntax : SLN(cost, salvage, life) Parameter : This method accepts three parameters as mentioned above and described below : cost : It specify the initial cost of the a
3 min read
TIME and TIME_TO_SEC Function in MariaDB 1. TIME Function : In MariaDB, The TIME Function returns the time portion of a DateTime expression. In this function, the first parameter will be the DateTime. This function returns the time given a DateTime. In this function, we will pass the DateTime expression in it and it will return the time of
2 min read