网络时间校准

using Newtonsoft.Json;
using System;
using System.Net;

namespace TimeVerify
{
    class Program
    {
        static void Main(string[] args)
        {

            WebClient wc = new WebClient();
            var data = wc.DownloadString(@"http://quan.suning.com/getSysTime.do");

            var timeStr = JsonConvert.DeserializeObject<TimeModel>(data).sysTime2;
            var time = Convert.ToDateTime(timeStr);
            Console.WriteLine(time);
            Console.ReadLine();
        }
    }

    public class TimeModel
    {
        public string sysTime2 { get; set; }
    }
}

 

posted @ 2021-09-15 17:36  China Soft  阅读(804)  评论(0编辑  收藏  举报