CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Time Series Analysis in SQL Server

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

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;
Modifier et exécuter le code