开发者

AJAX countdown timer to show hours and not days

开发者 https://www.devze.com 2023-03-05 15:03 出处:网络
I\'ve implemented this AJAX countdown timer successfully: - http://forums.asp.net/t/1085601.aspx I created these 3 labels:

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号