I am having some difficulty making a countdown timer that will countdown to March 30, 2003 using days, hours, minutes, and seconds.
Printable View
I am having some difficulty making a countdown timer that will countdown to March 30, 2003 using days, hours, minutes, and seconds.
Well, thanks for letting us know. :rolleyes:
What do you have so far, so we can try to see what you are having trouble with?
I've never used the DateDiff function before, but I think that's how it works... someone help this poor soul if I geot it wrong... :)VB Code:
Dim CD As Date 'Countdown Dim N As Date 'Now date Dim E As Date 'End date N = Now E = Format("03-30-03", "MM-DD-YY") CD = DateDiff(N, E)
I dont know how it is done, I have no idea where to start
very good example
See this link
I am just looking to make one that is just a timer object and a label. No extra stuff involved, just a simple little form that will display just how many Days, Hours, Minutes, Seconds until March 30, 2003.
this is the way I would do itVB Code:
Option Explicit Dim seconds As Double Dim minutes As Integer Dim hours As Integer Dim days As Long Dim target As Date Private Sub Form_Load() target = #3/30/2003# ' or CDate("March 30, 2003") Timer1.Interval = 500 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Dim strCap As String seconds = DateDiff("s", Now, target) If seconds < 0 Then Timer1.Enabled = False Exit Sub End If days = seconds \ 86400 seconds = seconds - (days * 86400) hours = seconds \ 3600 seconds = seconds - (hours * 3600) minutes = seconds \ 60 seconds = seconds - (minutes * 60) strCap = days & " Days" & vbCrLf strCap = strCap & hours & " Hours" & vbCrLf strCap = strCap & minutes & " Minutes" & vbCrLf strCap = strCap & seconds & " Seconds" Label1.Caption = strCap End Sub
Alright thanks guys