How to Display a Date in British Format in SQL Server (T-SQL)

This article demonstrates how to explicitly format a date in Great Britain English format when using the T-SQL FORMAT() function in SQL Server.

You may or may not need to use this argument, depending on the language of your local session. However, here’s how to explicitly specify Great Britain English date format.

Continue reading

How to Display a Date in US Date Format in SQL Server (T-SQL)

In SQL Server, you can use the T-SQL FORMAT() function to display a date in the desired format. This function accepts an optional “culture” argument, which you can use to specify US date format.

You may or may not need to use this argument, depending on the language of your local session. However, here’s how to explicitly specify US date format.

Continue reading

WEEK() Examples – MySQL

In MySQL, you can use the WEEK() function to get the week number for a given date. By “week number” I mean the week of the year.

To use the function, simply provide the date as an argument and the week number will be returned.

You also have the option of specifying whether to start the week on Sunday or Monday, and whether the week should be in the range 0 to 53 or 1 to 53.

Continue reading

UTC_TIMESTAMP() Examples – MySQL

In MySQL, you can use the UTC_TIMESTAMP function to return the UTC date and time. UTC stands for Coordinated Universal Time and it’s the primary time standard by which the world regulates clocks and time.

The result of this function is returned either in ‘YYYY-MM-DD HH:MM:SS’ or YYYYMMDDHHMMSS format, depending on whether it’s used in a string or numeric context.

Continue reading