Aan de slagGa gratis aan de slag

Formatting dates with FORMAT()

The FORMAT() function allows for additional flexibility in building dates. It takes in three parameters: the input value, the input format, and an optional culture (such as en-US for US English or zh-cn for Simplified Chinese).

In the following exercises, we will investigate three separate methods for formatting dates using the FORMAT() function against the day that Python 3 became generally available: December 3rd, 2008.

Deze oefening maakt deel uit van de cursus

Time Series Analysis in SQL Server

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

DECLARE
	@Python3ReleaseDate DATETIME2(3) = '2008-12-03 19:45:00.033';

SELECT
	-- Fill in the function call and format parameter
	___(@Python3ReleaseDate, ___, 'en-US') AS US_d,
	___(@Python3ReleaseDate, ___, 'de-DE') AS DE_d,
	-- Fill in the locale for Japan
	___(@Python3ReleaseDate, ___, ___) AS JP_d,
	___(@Python3ReleaseDate, ___, 'zh-cn') AS CN_d;
Code bewerken en uitvoeren