首页 > Windows开发 > 详细

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

时间:2021-04-01 18:22:42      阅读:35      评论:0      收藏:0      [点我收藏+]

-

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));
        }

 

-

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!