Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my question is to be that when i use the two text boxes here one textbox for from date and another textbox for to date can be given .... here counting the num of days and also saturday,sunday and other restricted holidays are not counting .... for example when i take the two holidays like friday to monday only two days are displayed .... so plz give the code
Posted
Updated 6-Dec-11 22:13pm
v3

You need to get your dates into DateTime[^] objects, either via some conversion process or by using DateTimePicker[^]s. You can then use the TimeSpan[^] class to calculate the number of days between the dates. Checking for weekends is just a matter of mathematics; checking for public holidays requires some locally defined tables.
 
Share this answer
 
hi try with this
SQL
select *  from
 t01_user where datename(dw,date) not in ('Saturday','Sunday')



regards.
pal
 
Share this answer
 
Comments
palraj001 7-Dec-11 6:37am    
select count(*) as days from
yourtablename where datename(dw,yourdatefieldname) not in ('Saturday','Sunday')
see behind you i can get u the code
 
Share this answer
 
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900