How to Return the Day Number with a Suffix in MariaDB

MariaDB includes a large collection of date and time functions that return a given date in a certain format.

One thing you can do is return the day number with the relevant “st/nd/rd/th” suffix. For example, instead of returning it as say, 10 July 2025, it’s returned as 10th July 2025.

Below is an example of adding the relevant suffix to a day number in MariaDB.

Continue reading

Add the Ordinal Indicator to a Date in Oracle

In Oracle Database, we can use the TH format element to add the ordinal number suffix to the result of a TO_CHAR() operation when formatting dates.

For example, instead of outputting 10 Feb we could output 10th Feb. Or, instead of outputting 21 century, we can output 21st century. The same applies for spelled date components. For example, instead of Twenty One, we can output Twenty First.

Continue reading

How to Spell Out the Year when Formatting a Date in Oracle

Oracle Database includes a good selection of datetime format elements. that enable us to format dates and times when using the TO_CHAR(datetime) function.

One of these (the YEAR format element) allows us to format a date with the year spelled out. For example, instead of 1972, we’d get NINETEEN SEVENTY-TWO.

We can also use SYEAR so that BC dates are prefixed with a minus sign (-).

Continue reading