Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Find no if weekend days from 2 given dates..

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
velu - 11 Jul 2006 13:59 GMT
i am trying to create a function that take 2 SelectedDate from a Calendar and
calculates the no. of days between 2 dates and also calculates the no of
weekends (sundays and saturdays) and at last it gives the difference between
total days minus weekdays..

when i run this script the loop is not ending...my sysytem hangs...

calFromDay.SelectedDate ' from day
calToDay.SelectedDate ' to day

Function ndays(ByVal Fromdate As Date, ByVal Todate As Date)

       ' define sunday, daterday, ubilice holiday dates
       Dim sDay, As Integer
       ' define total day and total leave and result days.
       Dim tday, lday, bday As Integer

       'calculate the difference
       tday = DateDiff(DateInterval.Day, Fromdate, Todate)
       Response.Write("total days " & tday)

       'calculate the difference
       sDay = 0
       While Fromdate <= Todate   ' Test value of Counter.

           If Weekday(Fromdate) = 1 Or 7 Then
               sDay = +1
           End If
           Fromdate.AddDays(1)
       End While
       Response.Write("<br><br>Leave days " & sDay)
Response.Write("<br><br>balace is " & (tday -sDay))

    End Function
Brad Roberts - 11 Jul 2006 19:10 GMT
fromdate = fromdate.adddays(1)
Signature

Brad

"Software is like melted pudding..."

> i am trying to create a function that take 2 SelectedDate from a Calendar and
> calculates the no. of days between 2 dates and also calculates the no of
[quoted text clipped - 30 lines]
>
>      End Function

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.