I get a date in C# from javascript in this format:
"Tue Jan 15 00:00:00 UTC+0530 2008"
.
How can I convert this to "dd/MMM/yyyy"
format?
I get a date in C# from javascript in this format:
"Tue Jan 15 00:00:00 UTC+0530 2008"
.
How can I convert this to "dd/MMM/yyyy"
format?
var jsdate = "Tue Jan 15 00:00:00 UTC+0530 2008";
var format = "ddd MMM d HH:mm:ss UTCzzzzz yyyy";
var date = DateTime.ParseExact(jsdate, format, CultureInfo.InvariantCulture);
Console.WriteLine(date.ToString("dd/MMM/yyyy"));
Try this:
var test = "Tue Jan 15 00:00:00 UTC+0530 2008";
const string format = "ddd MMM d HH:mm:ss zzz yyyy";
var var = DateTime.ParseExact(test.Replace("UTC", ""), format, CultureInfo.InvariantCulture);
Console.WriteLine(var);