Here are some options for subtracting one or more hours from a datetime value in MariaDB.
dates
How to Subtract 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.
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.
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 (-).
Set 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 set the value of that variable.
4 Functions to Return the Month from a Date in MariaDB
Below are 4 functions that enable you to return the month from a date in MariaDB.
3 Ways to Return the Time Zone from a Datetime Value in Oracle
Below are three ways to return time zone information from a datetime value in Oracle Database.
2 Ways to Find Out Which Quarter a Date Belongs to in MariaDB
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.
How to Get the Century from a Date in Oracle
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.