惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
小众软件
小众软件
美团技术团队
Martin Fowler
Martin Fowler
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
J
Java Code Geeks
B
Blog
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
博客园 - Franky

博客园 - 丁焕轩

The SSL connection could not be established, see inner exception 错误 腾讯企业邮箱管理 万能五笔彻底删除,广告 C# 直接赋值 和 深拷贝 iis部署 访问 LINUX 基础 服务器无法从本地复制文件 修改引用api地图的样式,地图 程序用一段时间卡死、系统日志调试 博文阅读密码验证 - 博客园 sql server 常规问题 sql server 使用 elemenet 级联 博文阅读密码验证 - 博客园 框架问题排查 FreeSql 使用说明 oracle 最简单连接 .net 增加 Swagger 解决跨域 oracle 服务器 客户端安装,配置
utc时间戳 日期 转换
丁焕轩 · 2024-06-11 · via 博客园 - 丁焕轩

utc时间戳 日期 转换

 public long ConvertDateTimeToInt(DateTime time)
        {
            DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));    
            long t = (time.Ticks - startTime.Ticks) / 10000;       //除10000调整为13位
            return t;
        }

        

        private DateTime ConvertStringToDateTime(string timestamp)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            long lTime = long.Parse(timestamp + "0000");
            TimeSpan toNow = new TimeSpan(lTime);
            return dtStart.Add(toNow);
        }

posted @ 2024-06-11 16:21  丁焕轩  阅读(53)  评论(0)    收藏  举报