Ibrahim Shaikh Ibrahim Shaikh - 7 months ago 48
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


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");