.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() + "秒";

最新文章

  1. 关于回溯与n个数的全排列
  2. Windows Phone自带的语音识别
  3. sql中 查询条件出现单引号和特殊字符处理
  4. Dell U2913WM使用感受
  5. Python: 关于nose
  6. PLsql设置
  7. cocos2dx中加入unzip
  8. 10.30 afternoon
  9. Ubuntu启动时直接进入命令行模式
  10. mysql记录慢查询
  11. ffmpeg.c简单的结构功能分析(平局)
  12. 输入和输出--File类
  13. java 集合框架(二)Iterable接口
  14. C# 遍历所有的子控件和孙控件,包括容器中的,并批量操作和调用
  15. go语言学习--go中godep的使用小结
  16. 微信小程序使用wxParse,解决图片显示路径问题
  17. 二十四、Linux 进程与信号---wait 函数
  18. python 基础 Two day
  19. Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
  20. 知识点:Mysql 基本用法之函数

热门文章

  1. hbase 0.96 单机伪分布式配置文件及遇到的问题 find命令
  2. [BZOJ 3209] 花神的数论题 【数位统计】
  3. Reducing the Dimensionality of data with neural networks / A fast learing algorithm for deep belief net
  4. Pair of Numbers
  5. weblogic启动报错之WLS_DIAGNOSTICS000000.DAT
  6. ACM生活总结
  7. CodeForce 2A Winner
  8. 【数学规律】Vijos P1582 笨笨的L阵游戏
  9. Hierarchy Viewer显示视图性能指标
  10. [Hibernate] 基本增删查改