I have created a WCF Rest service for checking and validating license by comparing date. This service uses for Microsoft Dynamics CRM. CRM user can be from any country.
I have faced few issue since few days especially in the conversation of Date and comparing of it.
Service provides this date in "MM/dd/yyyy time" format. i.e 11/4/2027 12:00:00 AM
. It is in the string. I want to convert it in DateTime format such a way that it should convert according to current DateTime format.
//C# Current code
string strValidUpToDate = "11/4/2027 12:00:00 AM";
Date validUpToDate = Convert.ToDateTime(11/4/2027 12:00:00 AM);
Above doesn't provide appropriate format if country changed.
Can anybody please guide me?