Last post Oct 15, 2010 08:26 AM by smirnov
Oct 15, 2010 07:23 AM|bhavik.y.shah|LINK
In my application, gridview is used to display data.
But the problem is that I want to show date in “dd-MM-yyyy hh:mm tt”.
In English culture it displays right format.
But when I change current culture to Swedish the date format changes to “dd-MM-yyyy hh:mm”
means it didn't displays “AM/PM” in Swedish.
There is not a single line change in code to get data and display in gridview.
So if any one of you have faced same problem then please give me appropriate solution for the same.
Oct 15, 2010 08:26 AM|smirnov|LINK
Because they use 24 hours clocks and AM/PM make no sense there.
If you always need to show time in the same format use the same culture in both cases
CultureInfo ci = new CultureInfo("en-GB");
string dateGB = DateTime.Now.ToString("dd-MM-yyyy hh:mm tt", ci);
Hope this helps.