Date and Time in WPF
Recently, i was fighting with a date/Time interpretation which makes me a kind of crazy.The scenario was collecting data from a return dataset based on SQL serve table. When looking in that dataset, the date/Time format of dat fields was formatted correctly based on the culture I get set. But as long as the data was rendering by my WPF gridview, Date/Time value gets disply in different manner.
After browsing around I met Mike Danes on a forums which gets similar trouble.
When you convert a date time to string in code the current (correct) culture is used. However WPF doesn’t use the current culture, it takes the culture name from the Language property of the FrameworkElement and then gets the culture by using GetCultureInfoByIetfLanguageTag. This method returns a standard CultureInfo object, not the user customized version. This has been reported as a bug by Mike already.
To overcome this, it was needed to apply a converter to my date/Time column field.
I would never seen that problem if my users did not start to change cutsom settings of standard culture.
Hope it could save you time as well.
Thanks to Mike as well helping me isolate the issue

