How 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 reading

How to Format the Date in MongoDB

If you have documents that store dates as Date objects, but you want to return them in a different format, you can use the $dateToString aggregate pipeline operator.

For example, you might want a date to be returned in mm/dd/yyyy format instead of the long ISODate() format that includes minutes, seconds, milliseconds, etc

The $dateToString operator converts the Date object to a string, and optionally allows you to specify a format for the resulting output.

Continue reading