Reputation: 207
In my view, I want to display the MonthName in German. How can I change the monthname from English to German. DATENAME(month, getdate()) AS 'MonthName'
Upvotes: 16
Views: 55434
Reputation: 38094
It is possible to get month names in other languages using FORMAT
function:
DECLARE @Date DATETIME = '2019-10-18';
SELECT FORMAT(@Date, 'MMMM', 'en-US') AS YourMonthName -- OUTPUT: October
SELECT FORMAT(@Date, 'MMMM', 'es-es') AS YourMonthName -- OUTPUT: octubre
SELECT FORMAT(@Date, 'MMMM', 'zh-cn') AS YourMonthName -- OUTPUT: 十月
Upvotes: 18
Reputation: 4630
try:
see languages,
by SELECT * FROM sys.syslanguages
SET LANGUAGE Spanish
SELECT DATENAME(MONTH, GETDATE()) AS 'MonthName'
SET LANGUAGE German
SELECT DATENAME(MONTH, GETDATE()) AS 'MonthName'
SET LANGUAGE us_english
SELECT DATENAME(MONTH, GETDATE()) AS 'MonthName'
Upvotes: 22