Rob.Oakshott Rob.Oakshott - 1 year ago 76
ASP.NET (C#) Question

Why is en-IE culture not giving me AM PM in format string?

I have this code to set the culture

public static CultureInfo GetRegionDefaultCulture(int regionId)
// removed code to shorten....
return CultureInfo.CreateSpecificCulture("en-au");


using it here in the code behind in my test example

Thread.CurrentThread.CurrentCulture =

using this in aspx code behind of my test example

DateTime dtNow = DateTime.Now;
Response.Write("<br/>" + dtNow.ToString("dd MMM yyyy hh:mm tt"));


09 Nov 2010 04:42 PM

If I update the code to use any of these cultures, I also correctly get AM/PM in the output


If I update the code to use


the output is

09 Nov 2010 04:44

Am I missing something? Why is en-IE behaving differently?

Gained from @Jordans answer.

Adding this bit of code worked.

DateTimeFormatInfo info = CultureInfo.CurrentCulture.DateTimeFormat;
info.AMDesignator = "AM";
info.PMDesignator = "PM";

Answer Source

According to the documentation, if the culture doesn't use AM/PM, then nothing will be returned by tt.

For cultures that do not use an AM designator, this property returns an empty string.

I can't find any documentation on which cultures have an AM designator. The culture info is retrieved via a native method for which I can't find the source. You can generate your own list with the following code:

  .Where(c => string.IsNullOrEmpty(c.DateTimeFormat.AMDesignator)));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download