TO_DAYS Function and WEEK Function in MariaDB Last Updated : 02 Dec, 2020 Comments Improve Suggest changes Like Article Like Report 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 date is '0000-00-00'. It is reverse of FROM_DAYS function. Syntax : TO_DAYS( date ) Parameter : ParameterDescriptiondatedate to convert to numeric days. Return : It returns date into numeric days. Example-1 : SELECT TO_DAYS('2014-11-20'); Output : 735922 Example-2 : SELECT TO_DAYS('2014-11-18 05:30:00'); Output : 735920 Example-3 : SELECT TO_DAYS('0000-00-00'); Output : NULL WEEK Function : In MariaDB, Week Function is used to return the week portion of a date value. In this function, the first parameter will be date value and the second parameter will be mode. This function will return a value between 0-53 or 1-53 depending on the mode specified. This function returns the same as the WEEK function with the syntax of WEEK(date_value, 3). Syntax : WEEK( date_value, [ mode ] ) Parameters : ParametersDescriptiondate valueA date or datetime value from which to extract the week.modeOptional. It is used to specify what day the week starts on. Return : It returns the week portion of a date value. Example : SELECT WEEK('2020-01-05'); Output : 1 Comment More infoAdvertise with us Next Article TO_DAYS Function and WEEK Function in MariaDB vipinyadav15799 Follow Improve Article Tags : SQL DBMS-SQL Similar Reads 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 SECOND Function and SYSDATE Function in MariaDB 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 w 2 min read HOUR() and FROM_DAYS() function in MariaDB 1. HOUR() Function : In MariaDB, the HOUR() function is used to return the hour portion of a date value. In this function, the first parameter will be date_value. This function will return HOUR part of the given date. Since a time value can be range from -838:59:59' to '838:59:59' so that this funct 2 min read EXTRACT() and DAYOFYEAR() Function in MariaDB 1. EXTRACT() Function : In MariaDB, the EXTRACT() function is used to return extracts the extracts parts from a date. In this function, the first parameter will be an expression. The first part of expression will be unit and second part of expression will be a date. This function will return extract 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 Like