开发者

format the column (date) in an dataset

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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜