469,908 Members | 2,069 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,908 developers. It's quick & easy.

Detecting that date is on the same week or last week.

Hello,

I have to DateTime structure, how do I calculate if date A is on the same
week with date B or last week of date B?

Thanks,

Hadi
Nov 15 '05 #1
1 6546
if ( a. AddDays( 7- a.DayOfWeek ).Date.Equals(b.AddDays(
7-b.DayOfWeek ).Date) )

{

// their int the same week

}

else if ( a. AddDays( 7-
a.DayOfWeek ).Date.Equals(b.AddDays( -b.DayOfWeek ).Date) ){

// a is in the last week of b
}

Hope this help.

"Hadi" <ha**@hadi.net> дϢ
news:O0**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have to DateTime structure, how do I calculate if date A is on the same
week with date B or last week of date B?

Thanks,

Hadi

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by cg_news | last post: by
5 posts views Thread by Alicia | last post: by
reply views Thread by Lee Harr | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.