Question

The long date for culture "en-ca" is MMMM-dd-yy . This is correct and I have verified this with documentation. You can verify the result in .NET by doing the following.

   Dim culture As CultureInfo = CultureInfo.GetCultureInfo("en-ca")
   MsgBox(culture.DateTimeFormat.LongDatePattern)

I am trying to figure out why there is a difference with the NLS API which will return "MMMMM d, yyyy"as the default long date. This is incorrect. Am I missing something here? I'm just curious if anyone knows the specifics around this.

NLS API Reference: http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx

Was it helpful?

Solution

This has changed between .NET 3.5SP1 and .NET 4.0. .NET 3.5 produces MMMM d,yyyy, same as the documented Vista NLS value.

.NET 4.0 produces MMMM-dd-yy. Same as what I get when I use GetLocaleInfo() on Win7 with:

wchar_t buf[256];
GetLocaleInfo(0x1009, LOCALE_SLONGDATE, buf, 256);

I think .NET 4.0 is now using the Windows locale info instead of relying on its own tables. Nevertheless, nothing changes as fast as culture data. If you think this is incorrect then you can submit feedback at connect.microsoft.com

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top