i have an dataset with an column name as DATE it contain开发者_如何学Cs an value in this format 1/5/2010(month/day/year).
Now i need to change the data been displayed(format). 05-01-2010
any help how to solve this issue would be great.
Set the dataformatstring of the bound column to: "{0:dd-MM-yyyy}"
EDIT: for some reason I assumed you were binding to a grid, in any event, that format specifier will work if you do yourDateTimeVariable.ToString("dd-MM-yyyy");
You can parse it to DateTime
and then back to required string. Hope this helps.
DateTime d=DateTime.Parse("11/01/2005");
MessageBox.Show(d.ToString("dd-MM-yyyy"));
Tested :)
精彩评论