将UNIX时间转换为在线json的日期

时间:2016-04-05 16:01:18

标签: c# json unix visual-studio-2015

基本上我尝试做的就是使用这个api,api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=<key>&steamids=76561197960435530

并使用time created字段并显示从UNIX时间转换为常规时间

这是我制作的一些代码

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Linq;


    namespace JSONTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                string SteamKey = // key

                WebClient c = new WebClient();
                var data = c.DownloadString("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/" + "?key=" + SteamKey + "&steamids=76561197960435530");
               // Console.WriteLine(data);
                JObject o = JObject.Parse(data);
                Console.WriteLine("Name: " + o["response"]["players"][0]["timecreated"]);
                Console.ReadLine();


                // Prompt the user on what they want to do 

            }
        }
}

我得到了显示字段&#34; timecreated&#34;但我不知道如何将其转换为日期。指针将不胜感激。

0 个答案:

没有答案