In MariaDB, EXTRACT()
is a built-in date and time function that returns the specified unit from a given date or datetime expression.
Tag: functions
How DAYOFYEAR() Works in MariaDB
In MariaDB, DAYOFYEAR()
is a built-in date and time function that returns the day of the year from a given date.
It accepts one argument, which is the date you want to extract the day of the year from.
It returns the day as a number in the range 1
to 366
.
How WEEKDAY() Works in MariaDB
In MariaDB, WEEKDAY()
is a built-in date and time function that returns the week day from a given date.
It accepts one argument, which is the date you want to extract the week day from.
It returns the day as a number. The index numbering starts at zero for Monday (i.e. 0
= Monday, 1
= Tuesday, etc). This is in contrast to DAYOFWEEK()
, which adheres to the ODBC standard (1
= Sunday, 2
= Monday, etc).
How DAYOFWEEK() Works in MariaDB
In MariaDB, DAYOFWEEK()
is a built-in date and time function that returns the day of the week from a given date.
It accepts one argument, which is the date you want to extract the day of the week from.
It returns the day as a number. The index numbering adheres to the ODBC standard (1
= Sunday, 2
= Monday, etc). This is in contrast to WEEKDAY()
, where 0
= Monday, 1
= Tuesday, etc.
How DAYNAME() Works in MariaDB
In MariaDB, DAYNAME()
is a built-in date and time function that returns the name of the weekday for a given date.
It accepts one argument, which is the date you want to extract the day name from.
Continue readingMariaDB DAY() Explained
In MariaDB, DAY()
is a synonym for DAYOFMONTH()
. It returns the day of the month from a given date.
How DAYOFMONTH() Works in MariaDB
In MariaDB, DAYOFMONTH()
is a built-in date and time function that returns the day of the month from a given date.
It accepts one argument, which is the date you want to extract the day of the month from.
The result is in the range 1
to 31
. However, if the date has a zero day part (for example '0000-00-00'
or '2021-00-00'
), the result is 0
.
How DATE_FORMAT() Works in MariaDB
In MariaDB, DATE_FORMAT()
is a built-in date and time function that formats a date according to the given format string.
It requires two arguments; the date and the format string. It also accepts an optional third argument that allows you to specify the locale.
Continue readingHow DATEDIFF() Works in MariaDB
In MariaDB, DATEDIFF()
is a built-in date and time function that returns the difference, in days, between two dates.
It accepts two arguments, both of which are date or datetime expressions. It then subtracts the second date from the first.
Continue readingHow DATE() Works in MariaDB
In MariaDB, DATE()
is a built-in date and time function that extracts the date part of a date or datetime expression.
You pass the date/datetime expression as an argument when calling the function.
Continue reading