定义了label,用来接收显示的倒计时字符串,然后像诸如奥运会那样的倒计时,精确到几天几小时几分钟几秒,用C#写,
就是不知道用DateTime的哪些属性,当然还要定义一个倒计时的最终时间
如:
当前时间是:2009-11-17 11:11:11
最终时间是:2010-10-01 00:00:00如何写。大侠们,请指教!
就是不知道用DateTime的哪些属性,当然还要定义一个倒计时的最终时间
如:
当前时间是:2009-11-17 11:11:11
最终时间是:2010-10-01 00:00:00如何写。大侠们,请指教!
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
timer1_Tick(this, EventArgs.Empty);
}
private void timer1_Tick(object sender, EventArgs e)
{
TimeSpan ts = dtend- DateTime.Now;
lbl.Text = string.Format("剩余时间{0}天{1}:{2}:{3}", ts.TotalDays, ts.Hours, ts.Minutes, ts.Seconds);
timer1.Interval = 1000;
}