...

View Full Version : Listing week days without weekend



Balders
09-14-2005, 12:08 PM
Hi there,

I have a function to list the next 7 days from today. What I try to do now is to exclude the weekend days (Saturday and Sunday) from the list because business is closed and no service available.

Any ideas? Thanks very much for help. Here is code so far:

<ul class="nobullets">

<%

todayDate = Date()

i = 0

showdays = 7

do while i < 7 %>

<li><input type="radio" name="bookingDate" value="<%=todayDate+i%>" /><%=FormatDateTime(todayDate+i,vbLongDate)%></li>

<%i = i + 1

loop

%>

</ul>

NancyJ
09-14-2005, 12:19 PM
<ul class="nobullets">

<%

todayDate = Date()

i = 0

showdays = 7

do while i < 7
if weekday(todaydate+i) > 1 AND weekday(todaydate+i) < 7 then %>
<li><input type="radio" name="bookingDate" value="<%=todayDate+i%>" /><%=FormatDateTime(todayDate+i,vbLongDate)&", "%></li>

<% end if
i = i + 1

loop

%>

</ul>



weekday 1 and 7 are weekends, you can also use weekdayname(weekday(todayDate+i)) to show the name of the day

Balders
09-14-2005, 12:43 PM
CHEERS NancyJ

11 minutes and works like a treat

Thanks again

NancyJ
09-14-2005, 12:44 PM
CHEERS NancyJ

11 minutes and works like a treat

Thanks again

and that includes the time it took to google for the functions ;)

neocool00
09-14-2005, 01:56 PM
What, you don't work on Saturdays or Sundays? LOL



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum