Convert a JSON date to System.DateTime

.Net Convert a JSON date to System.DateTime.

.Net Convert a JSON date to System.DateTime

using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
 
namespace JsonDateTimeConverter
{
    public class Program
    {
        public static void Main(string[] args)
        {
            const string json = "{\"Date\" : \"\\/Date(1447541631063-0000)\\/\"}";
 
            var result = JsonConvert.DeserializeObject<ConvertedDate>(json,
            new IsoDateTimeConverter { DateTimeFormat = "dd/mm/yyyy:hh:mm:ss" });
 
            Console.WriteLine(result.Date);
            //Console.ReadKey();
        }
    }
    class ConvertedDate
    {
        public DateTime Date { get; set; }
    }
}
DEMO
Convert a JSON date to System.DateTime Convert a JSON date to System.DateTime Reviewed by Bhaumik Patel on 8:18 AM Rating: 5