472,121 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

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 7277
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.