Click or drag to resize
Json.NETDeserialize DateFormatString
 

This sample uses the DateFormatString setting to control how DateTime and DateTimeOffset are deserialized.

Sample
Usage
 1string json = @"[
 2  '7 December, 2009',
 3  '1 January, 2010',
 4  '10 February, 2010'
 5]";
 6
 7IList<DateTime> dateList = JsonConvert.DeserializeObject<IList<DateTime>>(json, new JsonSerializerSettings
 8{
 9    DateFormatString = "d MMMM, yyyy"
10});
11
12foreach (DateTime dateTime in dateList)
13{
14    Console.WriteLine(dateTime.ToLongDateString());
15}
16// Monday, 07 December 2009
17// Friday, 01 January 2010
18// Wednesday, 10 February 2010