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.
This exercise is part of the course
Time Series Analysis in SQL Server
Hands-on interactive exercise
Have a go at this exercise by completing this sample 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;