MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a day (or many days) from a given date.
Here’s an example of subtracting a day from a date in MariaDB.
MariaDB provides several ways to perform arithmetic on dates. This includes adding or subtracting a day (or many days) from a given date.
Here’s an example of subtracting a day from a date in MariaDB.
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.
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 (-).
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 set the value of that variable.
Below are 4 functions that enable you to return the month from a date in MariaDB.
Below are three ways to return time zone information from a datetime value in Oracle Database.
If you ever need to find out which quarter a date belongs to in MariaDB, here are two functions that will allow you to do just that.
With Oracle Database, we can use the TO_CHAR(datetime) function to return the century from a datetime value.
To do this, we can use either the CC format element, or the SCC format element. We can combine these with other format elements to do things like, display the ordinal number, spell out the century, etc.
Here are some options for subtracting one or more seconds from a datetime expression in MariaDB.