0

I have a web service created which will accept date time as input.

The data type i used is system.datetime.

It accepting if the input is in mm/dd/yyyy or yyyy/mm/dd but not if dd/mm/yyyy.

How to solve this?

Tom Cruise
  • 1,395
  • 11
  • 30
  • 58

1 Answers1

0

You can use following logic

        string str = "26/11/2014";
        DateTime dt = DateTime.ParseExact(str, "dd/M/yyyy", CultureInfo.InvariantCulture);
        newString = dt.ToString("MM/dd/yyyy");
        Console.Write(newString);
        Console.ReadKey();

and can pass newStr to WebService Method.