---
title: "倒计时[C#]"
author: "DJ阿布"
date: "2011-08-29T17:28:28Z"
tags: []
categories: ["编程语言"]
slug: "c"
draft: false
lastmod: "2011-08-29T17:28:28Z"
id: 1160698
url: "https://itchen.iteye.com/blog/1160698"
---

//显示时间     
            DateTime now = DateTime.Now;  
            DateTime end = Convert.ToDateTime("2011-12-04 00:00:00");

            TimeSpan ts1 = new TimeSpan(now.Ticks);  
            TimeSpan ts2 = new TimeSpan(end.Ticks);  
            TimeSpan ts = ts1.Subtract(ts2).Duration();  
            string  dateDiff = ts.Days.ToString() + "天" + ts.Hours.ToString() + "小时"  
                            + ts.Minutes.ToString() + "分";