Hi,
I want to create dates in the following format: dd-MMM-yyyy e.g. 13-
Mar-2007
But are seeing some problems when running on a Japanese Windows XP.
Regional settings are set to JP.
Currently I am doing this
DateTime dat = DateTime.Now;
return String.Format("{0:dd}-{0:MMM}-{0:yyyy}", date);
US Windows returns 27-Feb-2007
Japanese Windows return 27-2-2007
So I tried to come up with a solution to that fixes but could only
find half of the solution.
CultureInfo ci = new CultureInfo("en-US");
datestring = dat.ToString("G", ci);
Console.WriteLine("en-US : " + datestring.Remove(datestring.IndexOf('
')));
This works on both versions but changed the date format to mm/dd/yyyy
When I do this:
DateTime dt = DateTime.Parse(datestring);
Console.WriteLine(dt.ToString("dd-MMM-yyyy"));
I am back to where I started!
Any help is much appeciated...
Regards
Lars Schouw