Persian culture in Windows Server 2012 r2

921 Views Asked by At

In our development machine which is running on Windows 10, "fa-IR" culture works fine and all dates display using Persian calendar. But when we deploy our app on Windows Server 2012 r2, datetime is still in Gregorian.

3

There are 3 best solutions below

2
On

It's most likely that the fr-IR culture is not installed on the server.

See Installing more cultures on Windows Server 2012 for more help.

0
On

for clarification of the problem we have with fa-IR in Windows Server2012, here is an example that works fine in Windows 10 but do not work in Windows 2012:

DateTime startDate;
CultureInfo c = CultureInfo.CreateSpecificCulture("fa-IR");
DateTime.TryParse("1990/02/01", new CultureInfo("en-US"), DateTimeStyles.None, out startDate);
Console.WriteLine(startDate.ToString("D", c));

The Windows 10 result (fine): پنجشنبه, 12 بهمن 1368
The Windows 2012 result (just persian letters):پنجشنبه، 01 فوريه 1990

1
On

This depends on the version of Windows, Persian calendar was added in Windows Server 2012 R2 And Windows 10.

SQL Server FORMAT with culture parameter not working