AJAX countdown timer to show hours and not days
I've implemented this AJAX countdown timer successfully: - http://forums.asp.net/t/1085601.aspx
I created these 3 labels:
Label1.Text = time1.Hours.ToString();
Label2.Text = time1.Minutes.ToString();
Label3.Text = time1.Seconds.ToString();
Le开发者_如何学编程ts say I set the timer countdown from over 24 hours (say 72 hours)
Session["time"] = DateTime.Now.AddHours(72);
How can I make Label1.Text show 72 instead of 24 so that I have no need to add the Day label as follows?
Label0.Text = time1.days.ToString();
You just need to calculate the hours from time:
Label1.Text = ((time1.Days * 24) + time1.Hours).ToString()
精彩评论