How WEEK() Works in MariaDB

In MariaDB, WEEK() is a built-in date and time function that returns the week from a given date expression.

It accepts two arguments; the date you want to extract the week from, and an optional mode argument to specify the mode to use in the result.

It returns the week as a number in the range 0 to 53 or 1 to 53, depending on the mode being used.

Read more

How MONTH() Works in MariaDB

In MariaDB, MONTH() is a built-in date and time function that returns the month from a given date expression.

It accepts one argument, which is the date you want to extract the month from.

It returns the month as a number in the range 1 to 12 for January through December. If the date has a zero month part (e.g. 0000-00-00 or 2025-00-00), the result is 0.

Read more

How HOUR() Works in MariaDB

In MariaDB, HOUR() is a built-in date and time function that returns the hour from a given time expression.

It accepts one argument, which is the time you want to extract the hour from.

For time-of-day values, it returns the hour as a number in the range 0 to 23. However, the range of TIME values can be much larger, and therefore, the returned value can be much higher than 23.

The return value is always positive, even if a negative time is provided.

Read more

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).

Read more

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.

Read more