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!

How to compare military time and doay of the week?

Status
Not open for further replies.

rkckjk

IS-IT--Management
Apr 27, 2001
34
US
How would I check to see if the current time(military format) is
greater then 07:30AM and the day of the week is Monday-Friday.

Pseudo code:

If Current_Time > 07:30AM and Current_Day = Monday or Current_Day =
Tuesday _
or Current_Day = Wednesday or Current_Day = Thursday or Current_Day =
Friday
then
Do this
else
Do something else
end if
 
Code:
        If TimeOfDay > #7:30:00 AM# And Not (Now.Day = 5 Or Now.Day = 6) Then
            'code for day Monday to Friday
        Else
            'code for time > 7:30:00 AM OR day = Saturday or Sunday 
        End If

To understand what I do write "day." and select a day watching the tooltexttip that appears. Each day has a number...


Ok ???
 
now.day will return the day of the month.

try something like this:
Code:
if now.dayofweek <> dayofweek.saturday and _
   now.dayofweek <> dayofweek.sunday and _
   now > #7:30:00 AM# Then
  'your code
end if

-Rick

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

[monkey] I believe in killer coding ninja monkeys.[monkey]
 
I do not agree with "now.day will return the day of the month
 
Check the documentation.

now.date returns todays date,
now.month returns the current month,
now.year returns the currenct year,
now.day returns the currect day of the month (ie: 1-31)
now.dayofweek returns the day of the week (ie: 1-7)

-Rick

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

[monkey] I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top