Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Experts
how to know how many days difference between weekday to weekday
for example
Monday - wednesday = 2 days
.
.
Monday - Sunday = 7 days
.
.
Sunday - Monday = 1 day
like this..
please help me

thanks in advance...
Posted

try..
C#
var weekDay1  = DayOfWeek.Thursday;
var weeekDay2 = DayOfWeek.Monday;
var daysDiff  = (7 + (weeekDay2 - weekDay1)) % 7;

ref.
http://stackoverflow.com/questions/9219083/get-difference-in-days-between-two-weekdays[^]
 
Share this answer
 
Comments
NaniCh 12-Feb-15 8:41am    
thanks for your help
Suppose you just need to compare two neighbouring weeks.
 
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