C# 获取时间戳(支持毫秒)

时间:2020-05-15 15:22:06   收藏:0   阅读:1027

 

 

获取时间戳(支持毫秒)

1         public static long CurrentTimeStamp(bool isMinseconds = false)
2         {
3             var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
4             long times = Convert.ToInt64(isMinseconds ? ts.TotalMilliseconds : ts.TotalSeconds);
5             return times;
6         }

 

原文:https://www.cnblogs.com/MichaelJson/p/12894767.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!