Below are two functions that can be used to extract the year from a date in Oracle Database.
Continue readingTag: dates
How to Check the Date Format of your Oracle Session
When working with functions that return dates, Oracle Database returns these dates based on the value of the NLS_DATE_FORMAT
parameter.
There is also an NLS_TIMESTAMP_FORMAT
parameter and an NLS_TIMESTAMP_TZ_FORMAT
parameter, both of which have a datetime format mask that can be specified separately.
All of these parameters have their default values derived from the NLS_TERRITORY
parameter (which by default, is operating system-dependent).
How to Change the Date Format in your Oracle Session
When working with functions that return dates, Oracle Database returns these dates based on the value of the NLS_DATE_FORMAT
parameter.
There is also an NLS_TIMESTAMP_FORMAT
parameter and an NLS_TIMESTAMP_TZ_FORMAT
parameter, both of which have a datetime format mask that can be specified separately.
All of these parameters have their default values derived from the NLS_TERRITORY
parameter (which by default, is operating system-dependent).
So, to change the date format for your session, you can either update the NLS_TERRITORY
parameter, or explicitly update each parameter individually.
This article provides examples of checking and changing these values, and viewing the results.
Continue readingHow to Get the Short Day Name from a Date in MariaDB
In MariaDB, you can use the DATE_FORMAT()
function to return various date parts from a date. One of the things you can return is the short day name. For example Tue
or Wed
(instead of Tuesday
or Wednesday
).
3 Ways to Convert a String to a Date in MongoDB
If you have a MongoDB collection with dates stored as strings, you can convert those into the Date BSON type if required.
Below are three ways to convert a string into a Date in MongoDB.
Continue readingChange the Time Zone Offset on a datetimeoffset Value in SQL Server (T-SQL)
You can use the SWITCHOFFSET()
function in SQL Server to change the time zone offset on a datetimeoffset value.
The function accepts two arguments; a datetimeoffset(n) value (or an expression that can be resolved to a datetimeoffset(n) value), and the new time zone.
Continue readingMongoDB Aggregation Operators for Returning Date Parts
This article lists the various aggregation pipeline operators that can be used to return individual date parts from a Date object in MongoDB.
Continue reading4 Functions to Get the Hour from a Time Value in MariaDB
Below are 4 functions that enable you to return the hour from a time value in MariaDB.
Continue reading8 Functions to Return the Day from a Date in MariaDB
MariaDB has quite a number of functions that return the day from a date. It all depends on how you want to do it, and what you mean by “day”.
MariaDB needs to know whether you want the day name, the day of the week number, the day of the month, day of year, etc.
Below are 8 functions that enable you to return the day from a date in MariaDB, in its various forms.
Continue reading2 Ways to Get the Short Month Name from a Date in MariaDB
Here are two ways to return the short month name from a date in MariaDB.
Continue reading