PDA

Click to See Complete Forum and Search --> : Countdown Clock


Electron
Dec 13th, 1999, 05:28 PM
Hey!

I need some help with the code for a countdown clock. It's not for New Year's, it's for an event I am looking forward to in February 2000. I know I need to use the DateDiff function, but not sure on how to make it countdown the months, days, minutes, and probably seconds.

Any advice would be much appreciated!

Thanks,
Jeff

Serge
Dec 13th, 1999, 06:25 PM
Drop a Timer control onto your form, change it's Interval property to 100. Also add a label to your form and use something like this:


Private mdatTimer As Date
Private Sub Form_Load()
mdatTimer = #2/15/2000# 'Set your date here
End Sub
Private Sub Timer1_Timer()
Dim sngSecs As Single
sngSecs = DateDiff("s", Now, mdatTimer)
Label1.Caption = Fix(((sngSecs / 60) / 60) / 24) & " Days, " & Fix((sngSecs / 60) / 60) Mod 24 & " Hours, " & Fix((sngSecs / 60)) Mod 60 & " Mins & " & (sngSecs Mod 60) & " Seconds until: " & Format(mdatTimer, "mmmm dd, yyyy")
End Sub


Regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)



[This message has been edited by Serge (edited 12-14-1999).]