Ibrahim Shaikh Ibrahim Shaikh - 1 month ago 16
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

10-October-2016
but I want to convert it into
10-10-2016


I want to convert it in webservice itself

can anyone help me out

Answer

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