当前位置:网站首页>C#计算两个时间相差多少天、时、分、秒
C#计算两个时间相差多少天、时、分、秒
2022-08-09 02:21:00 【yutiedun】
计算两个时间相差多少天、时、分、秒
DateTime DateTime1 = Convert.ToDateTime("2020-03-25 10:30:00"); //开始时间
DateTime DateTime2 = DateTime.Now; //当前时间
TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
TimeSpan ts = ts1.Subtract(ts2).Duration();
string dateDiff = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒";
MessageBox.Show("已运行" + dateDiff);
边栏推荐
- 2022PMP项目管理认证考试报考指南(1)
- The security of the pension insurance?Reliable?
- 企业面临的五大数据安全挑战
- Line segment tree of knowledge
- Mysql 5.7 into the pit
- MT4/MQL4 Getting Started to Mastering EA Tutorial Lesson 1 - MQL Language Common Functions (1) OrderSend() Function
- Programmer's Daily Life | Daily Fun
- 【云计算】XaaS最全介绍(按24字母合集):AaaS、BaaS、CaaS、DaaS、EaaS、FaaS、GaaS、HaaS、IDaaS…
- OpenMLDB + Jupyter Notebook:快速搭建机器学习应用
- 力扣刷题记录7.1-----707. 设计链表
猜你喜欢
线段树知识整理
程序员的日常生活 | 每日趣闻
力扣刷题记录3.1-----977. 有序数组的平方
js实现数组去重的方式(7种)
如何在群晖系统中安装cpolar(群晖6.X版)
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
SEMRush如何寻找关键词用于投放广告
9.1-----24. Swap the nodes in the linked list in pairs
Educational Codeforces Round 132 (Rated for Div. 2)
The first lesson of HNUMSC-C language
随机推荐
企业从云服务的承诺支出中获得最大收益的四种方法
Go-12-Structure
Summary of Database Design
企业面临的五大数据安全挑战
pytorch相关知识点总结
2022 China Eye Expo, China Beijing International Children and Adolescent Eye Health Industry Exhibition
MT4 / MQ4L entry to the master of EA tutorial lesson two (2) - - MQL language commonly used function account information commonly used functions
Open3D 计算点云的均值(质心)与协方差
Simple example of .reduce()
电磁辐射安全标准及检测方法
2022中国眼博会,中国北京国际儿童青少年眼睛健康产业展览会
How js implements array deduplication (7 kinds)
composer的使用记录
如何在推荐系统中玩转知识图谱
Phenomenon 1 during RF debugging
配置文件的读取-TOML
Z-Game on grid
如何在群晖系统中安装cpolar(群晖6.X版)
2022/8/8 Competition thinking + state pressure dp
2022眼康品牌加盟展,北京视力保健展,中国眼科医学技术峰会