[RESOLVED] Between Two Times...
Hi guys..
I'm looking to have my program have a night, and day mode.. It pulls in the almanac every time it loads, and I'd like to have it so that when the "Sunrise"'s the program will be in day mode, and when the "Sunset"'s it will go in to night mode..
Is there a way I can say something like:
If time now is between sunrise.Text and Sunset.Text then mode = day
Else
mode = night
How do I actually write this?
Re: [RESOLVED] Between Two Times...
I'm getting a "Type Mismatch"
Line:
Code:
If Time >= TimeValue(sunup.Caption) And Time <= TimeValue(sundown.Caption) Then
Re: [RESOLVED] Between Two Times...
I think it might involve that sunup.Caption simply reads "6:45"... Can I get my time from a label instead of the generic time?
Re: [RESOLVED] Between Two Times...
Code:
?Timevalue("6:45")
6:45:00 AM
?Timevalue("17:25")
5:25:00 PM
An alternative way:
Code:
Select Case TimeValue(Label1.Caption)
Case Is < TimeValue(sunup.Caption), Is > TimeValue(sundown.Caption)
mode = night
Case Else
mode = day
End Select