Ibrahim Shaikh Ibrahim Shaikh - 1 year ago 127
ASP.NET (C#) Question

Convert DateTime to dd-MM-yyyy format in webservice

I am creating a web app in which I am fetching a date from textbox into the webservice

current date format of my date is like this

but I want to convert it into

I want to convert it in webservice itself

can anyone help me out

Answer Source

You can convert using DateTime.ParseExact

string dt = "10-October-2016";
string date = DateTime.ParseExact(dt, "dd-MMMM-yyyy", CultureInfo.InvariantCulture).ToString("dd-MM-yyyy");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download