.net 计算当前时间距离今晚00:00:00还有多少分多少秒
2024-08-25 21:51:58
.net 计算当前时间距离今晚00:00:00还有多少分多少秒
string dateDiff = null;
//获取当前时间
DateTime DateTime1 = DateTime.Now;
//第二天的0点00分00秒
DateTime DateTime2 = DateTime.Now.AddDays().Date;
//把2个时间转成TimeSpan,方便计算
TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
//时间比较,得出差值
TimeSpan ts = ts1.Subtract(ts2).Duration();
//结果
dateDiff = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒";
最新文章
- 关于回溯与n个数的全排列
- Windows Phone自带的语音识别
- sql中 查询条件出现单引号和特殊字符处理
- Dell U2913WM使用感受
- Python: 关于nose
- PLsql设置
- cocos2dx中加入unzip
- 10.30 afternoon
- Ubuntu启动时直接进入命令行模式
- mysql记录慢查询
- ffmpeg.c简单的结构功能分析(平局)
- 输入和输出--File类
- java 集合框架(二)Iterable接口
- C# 遍历所有的子控件和孙控件,包括容器中的,并批量操作和调用
- go语言学习--go中godep的使用小结
- 微信小程序使用wxParse,解决图片显示路径问题
- 二十四、Linux 进程与信号---wait 函数
- python 基础 Two day
- Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
- 知识点:Mysql 基本用法之函数
热门文章
- hbase 0.96 单机伪分布式配置文件及遇到的问题 find命令
- [BZOJ 3209] 花神的数论题 【数位统计】
- Reducing the Dimensionality of data with neural networks / A fast learing algorithm for deep belief net
- Pair of Numbers
- weblogic启动报错之WLS_DIAGNOSTICS000000.DAT
- ACM生活总结
- CodeForce 2A Winner
- 【数学规律】Vijos P1582 笨笨的L阵游戏
- Hierarchy Viewer显示视图性能指标
- [Hibernate] 基本增删查改