I have a Date value for example:
string date = "02/14/2015" //(MM/DD/YYY)
I want to convert it into ISO Date Format. Is there anyway to do this..
I have a Date value for example:
string date = "02/14/2015" //(MM/DD/YYY)
I want to convert it into ISO Date Format. Is there anyway to do this..
Use the DateTime.ParseExact(dateString, format, provider);
function.
https://msdn.microsoft.com/en-us/library/w2sa9yss%28v=vs.110%29.aspx
Example:
CultureInfo provider = CultureInfo.InvariantCulture;
string date = "02/14/2015";
string format = "dd/mm/yyyy";
// Result is now a DateTime and can be easily converted
DateTime result = DateTime.ParseExact(date, format, provider);
try this:
string date = "02/14/2015"
DateTime NewDate= DateTime.ParseExact(dateString, "MM/DD/YYYY",
CultureInfo.InvariantCulture);
string NewFmt=NewDate.ToString("yyyy/MM/DD");
Try This...
string date = "02/14/2015";
DateTime d2 = DateTime.Parse(date, null, DateTimeStyles.RoundtripKind);