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?
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?
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.