10位,13位时间戳转为C#格式时间

-

public static DateTime ToDateTime(  string timestamp)
        {
            var tz = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1, 0, 0, 0, 0));
            return timestamp.Length == 13
                ? tz.AddMilliseconds(Convert.ToInt64(timestamp))
                : tz.AddSeconds(Convert.ToInt64(timestamp));
        }

-

原文地址:https://www.cnblogs.com/runliuv/p/14606796.html