MariaDB provides several ways to add a year or a certain number of years to a given date. For example, you might want to add 1 year, 10 years, 30 years, etc.
Here are 6 ways to add a year to a date in MariaDB.
Continue readingMariaDB provides several ways to add a year or a certain number of years to a given date. For example, you might want to add 1 year, 10 years, 30 years, etc.
Here are 6 ways to add a year to a date in MariaDB.
Continue readingHere are some options for subtracting one or more minutes from a datetime expression in MariaDB.
Continue readingIf you want to use named time zones in MariaDB, you’ll need to make sure they’ve been configured.
By “named time zones”, I mean being able to use strings like America/Los_Angeles
instead of −08:00
or −07:00
when specifying the time zone. For example, when using the CONVERT_TZ()
function.
Here’s how to configure named time zones in MariaDB.
Continue readingIf you have documents that store dates as Date objects, but you want to return them in a different format, you can use the $dateToString
aggregate pipeline operator.
For example, you might want a date to be returned in mm/dd/yyyy
format instead of the long ISODate()
format that includes minutes, seconds, milliseconds, etc
The $dateToString
operator converts the Date object to a string, and optionally allows you to specify a format for the resulting output.
MariaDB provides several ways to add a certain number of days to a given date. For example, you might want to add 10 days to a date, or 30 days, or even just 1 day. Fortunately, MariaDB makes this easy.
Here are 8 ways to add a number of days to a given date in MariaDB.
Continue readingBelow is a full list of the date and time units that can be used in MariaDB.
Continue readingYou can use the T-SQL code below to convert a month number to its corresponding name in SQL Server.
This is for times where you don’t actually have the full date – when all you have is the month number. If you do have the date, then here’s how to get the month name from a date.
Continue readingIn SQL Server, you can use the FORMAT()
function to return the short day name from a date. FORMAT()
is a T-SQL function that enables you to format dates and numbers to a specified format.
This function returns its result as a string. Specifically, it returns it as either a nvarchar or null as the case may be.
Continue readingHere are three T-SQL functions that you can use to extract the month from a date in SQL Server.
Continue readingYou can use the T-SQL function DATEPART()
to return the week number from a date in SQL Server.
By “week number” I mean the week’s number within the year of the specified date.
Continue reading