Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time function

Status
Not open for further replies.

Jceleste

Technical User
May 30, 2002
7
US
I am trying to write a script that will do this...

If the time is between 7am and 3am then

I need the correct code to do this. I am new at this! Any help would be appreciated. THanks.
 
hope this helps...

If (Hour(Time)>=7) Or (Hour(Time)<=3) Then
'7am to 3am the next day
End If

If (Hour(Time)>=3) And (Hour(Time)<=7) Then
'3am to 7am
End If

 
Thanks cgreynes, this helps so much, bear with me, I am REALLY new, but would this work for PM too? Is it the same, or is there a difference in the code? Such as 9am-5 pm?
 
its ok. im still new too:)
Hour() function returns hour in military format so 5PM is hour 17.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top