javascript countdown timer new date from database
<pre><code>&lt;script type="text/javascript"&gt;
        $(function() {
        var newYear = new Date();
        newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);
        $('#countdown').countdown({ until: newYear, format: 'DHMS', layout:
'&lt;div id="timer"&gt;' + '&lt;hr /&gt;'+
    '&lt;div id="timer_days" class="timer_numbers"&gt;{dnn}&lt;/div&gt;'+
    '&lt;div id="timer_hours" class="timer_numbers"&gt;{hnn}&lt;/div&gt;'+
    '&lt;div id="timer_mins" class="timer_numbers"&gt;{mnn}&lt;/div&gt;'+
    '&lt;div id="timer_seconds" class="timer_numbers"&gt;{snn}&lt;/div&gt;'+
'&lt;div id="timer_labels"&gt;'+
    '&lt;div id="timer_days_label" class="timer_labels"&gt;days&lt;/div&gt;'+
    '&lt;div id="timer_hours_label" class="timer_labels"&gt;hours&lt;/div&gt;'+
    '&lt;div id="timer_mins_label" class="timer_labels"&gt;mins&lt;/div&gt;'+
    '&lt;div id="timer_seconds_label" class="timer_labels"&gt;secs&lt;/div&gt;'+
'&lt;/div&gt;'+
'&lt;/div&gt;'
});
});
&lt;/script&gt;
</code></pre>

<p>I am using this script to show a countdown timer on my web page...but instead of <code>newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);</code> i want to get the new date from my database...how can i do that??</p>

<p>aspx code</p>

<p><code>&lt;asp:HiddenField runat="server" ID="HF" /&gt;</code>
Code behind [The date is 10\21\2011]
    ` </p>

<pre><code>If defaultJob = False Then
                sql.SelectCommand.CommandText = "SELECT OfferHeader, OfferDesc, MarketPrice, OfferPrice, Discount, PayInAdv, PayLater, ImageURL, AdTags,EndTime FROM " &amp; offerTable &amp; " WHERE CustID = '" &amp; custID &amp; "' AND BusiID=" &amp; busiID &amp; " AND OfferID=" &amp; offerID
            Else
                sql.SelectCommand.CommandText = "SELECT OfferHeader, OfferDesc, MarketPrice, OfferPrice, Discount, PayInAdv, PayLater, ImageURL, AdTags,EndTime FROM " &amp; offerTable &amp; " WHERE CustID = '" &amp; custID &amp; "' AND BusiID=" &amp; busiID &amp; " AND OfferID=" &amp; offerID
            End If

        Try
            con.Open()
            sql.Fill(table)
            con.Close()

            With table.Rows(0)
                LblOfferHeader.Text = Convert.ToString(.Item(0))
                LblOfferDesc.Text = Convert.ToString(.Item(1))
                LblMarketPrice.Text = Convert.ToString(.Item(2))
                LblOfferPrice.Text = Convert.ToString(.Item(3))
                LblDiscount.Text = Convert.ToString(.Item(4))
                LblPayInAdv.Text = Convert.ToString(.Item(5))
                LblPayLater.Text = Convert.ToString(.Item(6))
                ImgOfferImage.ImageUrl = Convert.ToString(.Item(7))
                HF.Value = Convert.ToString(.Item(9))
            End With
        Catch ex As Exception
            'MsgBox(ex.Message)
        Finally
            sql.Dispose()
            con.Close()
            con.Dispose()
        End Try`
</code></pre>

<p>The date coming from database is 10\21\2011 but the timer shows 36 mins left ....why?? what am i doing wrong???</p>
