Below are 4 functions that enable you to return the month from a date in MariaDB.
Continue readingTag: date functions
Add a Time Zone Offset to a datetime2 Value in SQL Server (T-SQL)
In SQL Server, the TODATETIMEOFFSET()
function was specifically designed to return a datetimeoffset value from a datetime2 value.
Given the fact that the datetime2 data type doesn’t actually support time zone offsets, and datetimeoffset must contain the offset, the TODATETIMEOFFSET()
function allows you to specify a time zone offset to use.
This article provides some examples to demonstrate.
Continue readingYEAR() Examples – MySQL
In MySQL, YEAR()
is a built-in date and time function that returns the year from a given date expression.
It returns the year as a number in the range 1000
to 9999
. For zero dates, it could return 0
or NULL
with a warning, depending on the values in your sql_mode
.
About the DATE_BUCKET() Function in Azure SQL Edge
T-SQL includes a DATE_BUCKET()
function that allows you to arrange data into groups that represent fixed intervals of time. It returns the datetime value that corresponds to the start of each datetime bucket, as defined by the arguments passed to the function.
As far as I’m aware, the DATE_BUCKET()
function is only available in Azure SQL Edge at the time of this writing.
Update: DATE_BUCKET()
was introduced in SQL Server 2022.
Difference Between SYSDATE() and NOW() in MariaDB
In MariaDB, the SYSDATE()
and NOW()
functions are similar in that they return the current date and time.
However, there is an important difference: SYSDATE()
returns the time that it executes, whereas NOW()
returns the time that the statement started executing.
And when run within a stored procedure or trigger, SYSDATE()
will return the time that it executes, whereas NOW()
will return the time that the stored procedure or trigger started executing.
TO_DATE() Function in Oracle
In Oracle Database, the TO_DATE()
function converts its argument to a value of DATE
data type.
2 Functions that Return the Month from a Date in Oracle
Below are two functions that can be used to extract the month from a date in Oracle Database.
Continue readingWEEKDAY() vs DAYOFWEEK() in MariaDB: What’s the Difference?
MariaDB provides a WEEKDAY()
function and a DAYOFWEEK()
function, both of which return the day of the week, represented as a number.
But the number returned is different between these functions.
This post looks at the difference.
Continue reading2 Ways to Get the Day from a Date in Oracle
Below are two functions that can be used to return the day from a date in Oracle Database.
Continue readingOracle Datetime Functions (Full List)
Below is a full list of datetime functions available in Oracle Database.
Continue reading