I have a countdown timer on my website which counts down to Sunday 3pm each week which is when our new sale starts. The timer seems to only decrement the minutes when the seconds reach 30, same with the hours too I think. Here's the code that was supplied for me and the timer can be seen on my webpage here.. http://www.onlinecarbooty.com/go-booting-front.aspx

VB...

    Dim seconds As Integer = DateDiff(DateInterval.Second, Date.Now, BootSale.nextDOW(DayOfWeek.Sunday))
    Dim days, hours, minutes As Integer
    days = seconds / 86400
    hours = (seconds Mod 86400) / 3600
    minutes = (seconds Mod 3600) / 60
    lblTimer.Text = days & " Day(s) " & hours & " Hour(s) " & minutes & " Minute(s) " ' & seconds Mod 60 & " Seconds"

    If Date.Now.DayOfWeek.ToString = "Sunday" And Date.Now.Hour >= 15 Then
        lblTimer.Text = "NEW SALE JUST GONE LIVE!"
    End If

Protected Sub timer1_tick(sender As Object, e As EventArgs)
    Dim seconds As Integer = DateDiff(DateInterval.Second, Date.Now, BootSale.nextDOW(DayOfWeek.Sunday))
    Dim days, hours, minutes As Integer
    days = seconds / 86400
    hours = (seconds Mod 86400) / 3600
    minutes = (seconds Mod 3600) / 60
    lblTimer.Text = days & " Day(s) " & hours & " Hour(s) " & minutes & " Minute(s) " & seconds Mod 60 & " Seconds"
End Sub

FRONT END...

<asp:Timer ID="timer1" runat="server" Interval="1000" OnTick="timer1_tick"></asp:Timer>

<asp:UpdatePanel id="updPnl" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <h2 class="boldStyle">NEW Sale starts in <asp:Label ID="lblTimer" runat="server"></h2></asp:Label></h2>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="timer1" EventName="tick" />
    </Triggers>
</asp:UpdatePanel>

Related posts

Recent Viewed