This is actually slightly more complicated than the suggested duplicates. Here's a related question that deals with parsing strings that contain time zone abbreviations.
To use the information in that answer with JSON.NET, you might be best off using a custom converter:
public class DateTimeWithTimezoneConverter : JsonConverter
{
public override object ReadJson(
JsonReader reader,
Type objectType,
object existingValue,
JsonSerializer serializer)
{
string t = serializer.Deserialize<string>(reader);
t = t.Replace("MST", "-07:00");
// Do other replacements that you need here.
return
DateTime.ParseExact(t, @"M/dd/yy h:mm:ss tt zzz", CultureInfo.CurrentCulture);
}
public override void WriteJson(
JsonWriter writer,
object value,
JsonSerializer serializer)
{
throw new NotImplementedException();
}
public override bool CanConvert(Type t)
{
return typeof(DateTime).IsAssignableFrom(t);
}
}
Note that this only handles the specific case you presented in your question. If you need support for more time zones, check the linked answer. If you have control over the code generating the strings, you might want to use an offset instead of a time zone abbreviation.
Here's an example of how you'd use it:
public class MyType
{
public string EntityType { get; set; }
public int CountValue { get; set; }
public DateTime LastUpdateDate { get; set; }
public int RowCnt { get; set; }
}
string json = "{\"entityType\":\"Phone\",\"countValue\":30,\"lastUpdateDate\":\"3/25/14 12:00:00 PM MST\",\"RowCnt\":30}";
MyType obj = JsonConvert.DeserializeObject<MyType>(
json,
new DateTimeWithTimezoneConverter());