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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find if specific date exsit in a week range

Status
Not open for further replies.

vituja

Programmer
Oct 1, 2003
30
US
Hi All,

I need to check to see if the beginning of a new year is within this weekrange. If so then do something.

I have a field (weekrange) that contains "12/29/2003 - 01/05/2004" (changes each week automatically).

In the example above 01/01/2004 exists within this weekrange
but I need to identify that it does.

How would I go about this. If it was SQL I would use something like:
...where convert(datetime,@DTE) between convert datetime,substring((select weekrange from Inserted),1,10))
and
convert(datetime,substring((select weekrange from Inserted),14,10))and netid=@netid and
weekrange=(select weekrange from Inserted))

But how would I go about this in VBScript? Any help would be appreciated. Thanks.





 
You could try something like this

dim sDate
sDate="12/29/2003 - 01/05/2003"
dim arrDate
arrDate=split(sDate," - ")
sdate1=cdate(arrDate(0))
sDate2=cdate(arrDate(1))
if (year(sDate1) <> year(sDate2) ) then
msgbox &quot;Year has changed&quot;
else
msgbox &quot;Year has not changed&quot;
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top