I have a listing page for articles that includes the date, converted into a long date string ("Friday, December 21 2018"). On all of my lower environments it is showing the dates in English but on prod it is showing the date in German.

date.Text = item.Date.ToLongDateString();

The site doesn't even use German as a language, just English and French. The listing page and all story items are English. I figure this must be an environmental Sitecore issue, since it shows in English on all lower environments. What could be causing this, and can I fix it without a code change?

  • Have you checked the culture settings of the production server? I wonder if it's set to German. Dec 21, 2018 at 17:01
  • would that be settings in Sitecore, or on the server itself? I believe the server is located in Germany so that would make sense Dec 21, 2018 at 17:03

2 Answers 2


date.ToLongDateString() executes in the background DateTimeFormat.Format(this, "D", DateTimeFormatInfo.CurrentInfo).

It means that the culture info is taken from the thread or from the server (you may want to double check if it's from both or from one of them only - I'm not sure anymore).

What you could do is passing the chosen culture to the Format method like

DateTimeFormat.Format(this, "D", new CultureInfo("en-GB"));

But that requires code change.

It should be also enough to set the globalization in web.config like:

<globalization culture="en-GB" uiCulture="en-GB">

I didn't have an option to test it though

  • thanks! now, my site does have both English and French. would adding "<globalization culture="en-GB" uiCulture="en-GB" mess up the French version (i.e. make the culture context english when it should be French)? Dec 21, 2018 at 17:21
  • I'm not sure if that would be possible to get the language automatically from the Sitecore context. You may try using "auto" instead of "en-GB" but I'm afraid you would need to change your code and pass the culture info.
    – Marek Musielak
    Dec 21, 2018 at 17:25
  • ok. i'll just go wtih the code change then. thanks! Dec 21, 2018 at 17:31

You can set language property to proper language code dor tour english anf french sites like this:

<site name="french" ... virtualFolder="/fr-FR" physicalFolder="/fr-FR" rootPath="/sitecore/content" startItem="/French/Home" language="fr-FR" ... /> <site name="english" ... virtualFolder="/en-GB" physicalFolder="/en-GB" rootPath="/sitecore/content" startItem="/English/Home" language="en-GB" ... />

Don't know your current setup of sites in config so take above configuration as example and especially mind the language attribute.

Then you can access this within your code like this Sitecore.Context.Language.

Therefore the code to format datetime field should be like:

DateTimeFormat.Format(this, "D", new CultureInfo(Sitecore.Context.Language));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.