If condition

D

dave

Hi
I need bit code to execute some part of code...
Something like

If ( its between friday 7.30 PM and monday 11 AM) Then

'execute this part of code

End if

Basically I want to check current system date and time and need if condition if its falls between friday 7:30 pm and monday 11 am)...
Can anyone help me to write If condition to fullfil my requirements...
Thanx in advance
dave
 
C

Christopher Williams

Some random articles that might help you though they do not address the
issue specifically

http://www.codeave.com/asp/code.asp?u_log=61

http://www.grape-info.com/doc/web/asp/contents2.html

http://www.psacake.com/web/gt.asp


Hi
I need bit code to execute some part of code...
Something like

If ( its between friday 7.30 PM and monday 11 AM) Then

'execute this part of code

End if

Basically I want to check current system date and time and need if condition
if its falls between friday 7:30 pm and monday 11 am)...
Can anyone help me to write If condition to fullfil my requirements...
Thanx in advance
dave
 
B

Bob Barrows [MVP]

dave said:
Hi
I need bit code to execute some part of code...
Something like

If ( its between friday 7.30 PM and monday 11 AM) Then

'execute this part of code

End if

Basically I want to check current system date and time and need if
condition if its falls between friday 7:30 pm and monday 11 am)...
Can anyone help me to write If condition to fullfil my requirements...
Thanx in advance
dave

function IsWeekend(dNow)
dim dTmp, dFri, dMon
dTmp= DateSerial(Year(dNow),Month(dNow),Day(dNow)) 'Date()
Do Until WeekDay(dTmp, vbSunday)= vbFriday
dTmp=DateAdd("d",-1,dTmp)
Loop
dFri=CDate(dTmp & " 19:30")
dMon=CDate(DateAdd("d",3,dTmp) & " 11:00")
If dNow >= dFri AND dNow <= dMon Then
IsWeekend = true
else
IsWeekend = false
end if
end function
msgbox isweekend(Now),,Now
msgbox isweekend(dateadd("d",1,Now)),,dateadd("d",1,Now)


Bob Barrows
 
D

dave

Thanx Bob
Really appreciated...
dave

Bob Barrows said:
function IsWeekend(dNow)
dim dTmp, dFri, dMon
dTmp= DateSerial(Year(dNow),Month(dNow),Day(dNow)) 'Date()
Do Until WeekDay(dTmp, vbSunday)= vbFriday
dTmp=DateAdd("d",-1,dTmp)
Loop
dFri=CDate(dTmp & " 19:30")
dMon=CDate(DateAdd("d",3,dTmp) & " 11:00")
If dNow >= dFri AND dNow <= dMon Then
IsWeekend = true
else
IsWeekend = false
end if
end function
msgbox isweekend(Now),,Now
msgbox isweekend(dateadd("d",1,Now)),,dateadd("d",1,Now)


Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top