Click here to Skip to main content
15,889,216 members
Articles / Web Development / ASP.NET

Find the count of a weekday between two dates without iterating/looping

Rate me:
Please Sign up or sign in to vote.
2.71/5 (4 votes)
11 Nov 2011CPOL 20.8K   1  
Single line in Linq This gets you the number of weekdays, i.e., Monday to Friday between given two dates.[VB]Dim dt1 As New Date(2011, 1, 1)Dim dt2 As New Date(2011, 1, 15)Dim days As Integer = (From d As Date In _ (Enumerable.Range(0, 1 +...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
Working since 2006 on VBA, VB6, VB.Net, C#, ASP.Net, MSSQL




  • Courage is not the absence of fear, but rather the judgement that something is more important than fear.
  • The fear of suffering is worse than the suffering itself.
  • People need not fear the unknown if they are capable of achieving what they need and want.
  • Every blessing ignored becomes a curse.
  • Sometimes what's in your head isn't as crazy as you think.
  • We never really grow up, we only learn how to act in public.
  • You can make very bad teams with very good individuals.
  • Admitting mistakes means you have a sense of responsibility in your actions and that shows you are more matured than almost anyone. -Nithin


Comments and Discussions