Oct 26th, 2002, 01:00 PM
#1
Thread Starter
New Member
Countdown Timer
I am having some difficulty making a countdown timer that will countdown to March 30, 2003 using days, hours, minutes, and seconds.
Oct 26th, 2002, 01:33 PM
#2
Well, thanks for letting us know.
What do you have so far, so we can try to see what you are having trouble with?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Oct 26th, 2002, 01:34 PM
#3
Good Ol' Platypus
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'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...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
(Just a heads-up)
Oct 26th, 2002, 01:34 PM
#4
Thread Starter
New Member
I dont know how it is done, I have no idea where to start
Oct 26th, 2002, 01:50 PM
#5
Sleep mode
Attached Files
Oct 26th, 2002, 01:59 PM
#6
Software Eng.
Oct 26th, 2002, 05:05 PM
#7
Thread Starter
New Member
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.
Oct 26th, 2002, 05:39 PM
#8
this is the way I would do it
VB 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
Oct 26th, 2002, 06:40 PM
#9
Thread Starter
New Member
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width