Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Listing week days without weekend

    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>

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    Code:
    <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
    Last edited by NancyJ; 09-14-2005 at 12:21 PM. Reason: explaination

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    CHEERS NancyJ

    11 minutes and works like a treat

    Thanks again

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,172
    Thanks
    19
    Thanked 65 Times in 64 Posts
    Quote Originally Posted by Balders
    CHEERS NancyJ

    11 minutes and works like a treat

    Thanks again
    and that includes the time it took to google for the functions

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Posts
    152
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What, you don't work on Saturdays or Sundays? LOL


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •