Friday, 15 January 2010

DateTime format Issue using Asp.net C# -



DateTime format Issue using Asp.net C# -

in below code have date format works on machine date format day/month/year not in month/day/year.pls help me rectify issue.

string startdate =datetime.parse(txtfromdate.text + " 00:00:00").tostring("yyyy-mm-dd" + " 00:00:00");

you can utilize datetime.parseexact() parse date in specific format. see msdn article on how utilize it.

in case can utilize this:

cultureinfo provider = cultureinfo.invariantculture; string startdate = datetime.parseexact(txtfromdate.text, "mm/dd/yyyy", provider).tostring("yyyy-mm-dd hh:mm:ss");

c# asp.net

No comments:

Post a Comment