简体   繁体   English

计时器倒数SQL,ASP.NET C#

[英]Timer countdown sql, asp.net c#

i have table with the desgin: 我有设计的桌子:

========== ==========

id  (int, key)
itemName (nvarchar max)
offerClosing (datetime)

at the offerclosing i'm enter the date and time of the end of the offer to the item... example, now we at 16/5/2011 15:20 and the sale will end at 16:20, i want that at some lable will be timer countdown that will countdown one hour untill we get 16:20. 在要约结束时,我要输入要约结束日期和时间...例如,现在我们在2011年5月16日15:20,销售将在16:20结束,我希望在一些标记将是计时器倒数,这将倒数一小时,直到我们得到16:20。

hope that's clearly and that possible. 希望这是明确的并且可能的。

I think when you load the page you should subtract the offerClosing time - Datetime.Now. 我认为在加载页面时,您应该减去offerClosing时间-Datetime.Now。 Then you need to use javascript to subtract every second. 然后,您需要使用javascript减去每秒。 This is similar to what Ebay does when an auction is nearing close. 这类似于在拍卖临近时Ebay所做的事情。 As far as the actual javascript I dont know offhand but I think you could google that 据实际的JavaScript我不知道副手,但我认为你可以谷歌

I'm assuming the countdown is displaying in a web browser. 我假设倒计时在网络浏览器中显示。 You'll want to write the countdown in javascript. 您将要用javascript编写倒计时。 Basically, store the offerClosing in a javascript variable and then use setTimeout with an interval of 1000ms (1s) to update the display of time remaining. 基本上,将offerClosing存储在javascript变量中,然后使用间隔为1000ms(1s)的setTimeout更新剩余时间的显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM