views:

46

answers:

2

I've got a Silverlight application that shows some data. I use a DateTimeConverter to convert the DateTime value into a String. I use the dateTime.ToString("G") format and I get back 01/01/2010 12:01 or something like that. So far so good.

However, the same application on a Mac shows 01/01/2010 12:01 +02:00. That's the time CET with the current offset from UTC (so the time UTC is 10:01).

What is going on? Is there a special setting on the Mac? I played with the system settings and removed the CET and others from the text format but I still get the exact same result. Is this a bug?

EDIT: when I display the format pattern as suggested in the answer, I have HH:mm:ss on the PC and HH:mm:ss zzzz on the Mac. Cheers.

A: 

That suggests the LongTimePattern is different on the Mac. (The "G" format specifier means "Short date and long time pattern".)

Try displaying CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern on both platforms and see what they say.

Jon Skeet
A: 

Although on Windows changing the format in the control panel changes the format on a page refresh, this is NOT the case on MacOSX.

The setting used by the G format string is the Full format in System preferences -> Language & Text -> Times and not the Long format as I expected.

And once the settings are modified you HAVE to log off and log back in to see the changes.

The MSDN documentation should be a bit clearer on that methinks.

Thanks for the pointers Jon!

My only issue now is that I set the current culture for the user (so that the user can choose his language) and that unfortunately overrrides the user formatting if the language isn't the same as the one from his system. At least now I know what to tell the users.

R4cOON