There are several ways to return the year from a date in SQL Server. Here are three (or is it four?).
Continue readingTag: dates
8 Ways to Add Seconds to a Datetime Value in MariaDB
If you need to add one or more seconds to a datetime value in MariaDB, here are 8 options to consider.
Continue reading3 Ways to Get the Month Name from a Date in MariaDB
Here are three ways to return the month name from a date in MariaDB.
Continue readingSubtract a Month from a Date in MariaDB
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a month (or many months) from a given date.
Here’s an example of subtracting a month from a date in MariaDB.
Continue readingHow MONTHNAME() Works in MariaDB
In MariaDB, MONTHNAME()
is a built-in date and time function that returns the name of the month name for a given date.
It accepts one argument, which is the date you want to extract the month name from.
Continue reading6 Ways to Add a Month to a Date in MariaDB
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a month (or many months) from a given date.
Here are 6 ways to add a month to a date in MariaDB.
Bonus update: I’ve now added a 7th way to add a month to a date at the end of this article. So I guess it’s now 7 ways to add a month to a date in MariaDB 🙂
Continue readingReturn the Language used for Date & Time Functions in MariaDB
MariaDB has a lc_time_names
system variable that controls the language used by the DAYNAME()
, MONTHNAME()
and DATE_FORMAT()
date and time functions.
Here’s how to return the value of that variable.
Continue readingHow to Show all Locales in MariaDB
MariaDB supports a large list of locales that are used by functions such as DAYNAME()
, MONTHNAME()
and DATE_FORMAT()
.
While these locales are available to MariaDB, by default they’re not loaded into any of the system tables, so you can’t run a query to retrieve them.
However, MariaDB provides a plugin that does load these into a table. Once the plugin has been installed, you can query that table to return the locales available in MariaDB.
Continue readingDate & Time Locales Available in MariaDB
Below is a full list of date and time locales available in MariaDB.
Continue readingMariaDB Date Format Strings
Below is a full list of format specifiers that can be used in format strings with functions like DATE_FORMAT()
, STR_TO_DATE()
, and FROM_UNIXTIME()
in MariaDB.