c# - Calendar Extender date picking and converting into correct format -
i picking value calender extender in textbox , getting value in format {"mm/dd/yyyy"}
want in format {"dd/mm/yyyy"}
in textbox ( txt_actualrightformat.text
) code shown below
datetime wrongformat = datetime.parse(textbox4.text); string rightformat = string.format("{0:dd/mm/yyyy}", wrongformat.date); txt_actualrightformat.text = rightformat.tostring();
datetime
irespective of format, format displaying purpose. if not getting right date in wrongformat
can use datetime.parseexact
format. ,
txt_actualrightformat.text = wrongformat.tostring("dd/mm/yyyy");
edit:
use datetime.parseexcat
like:
datetime dt = datetime.parseexact(textbox4.text, "mm/dd/yyyy", cultureinfo.invariantculture); txt_actualrightformat = dt.tostring("dd/mm/yyyy");
Comments
Post a Comment