Know that you can figure out what week number it is but one can calculate the number of weeks between two dates. Have problems when I view weeks and dates are selected at the beginning of the year. For example, in early January, which then can be Week 1 and also the end of December could be week 1 so I can not get it together when it is not always the value at year-end. I want the number of weeks between the selected dates.Also has a problem when selecting dates will be week 2 of the start date and end date is Week 1. Minus the number of weeks, though it should be was 51 weeks
If you want to find the difference between two dates, just subtract one from the other and divide to get the appropriate unit (days, weeks, whatever) and either round, ceil or truncate to get an integer. Worrying about what their “week number” is just adds complications.
That said, depending what your requirements are, you may need to worry about what weekday it is. If the dates are Monday and Friday of the same week, is that 1 week or 0 weeks difference? What about if they’re Thursday and Monday of consecutive weeks; is that 1 or 0 weeks? If the answers to these questions are different, then you’ll need to adjust for the weekday, because they’re the same number of days apart.
what is considered a week? Is it 5 days, 7 days or can a week be just 2 days if there are only 2 days in the work week for that month? For instance, if the start date is Jan. 01, 2010 and end date is Jan. 14, 2010 should the week count be 2 or 3? Since there are only 2 days in work week 1 (Fri and Sat) do those 2 days count as 1 week?