My Assistant
![]() ![]() |
|
|
May 6 2012, 01:02 PM
Post
#1
|
|
|
New Member Posts: 3 |
Here's what the help in Access shows re: DateDiff and in particular the "w" and "ww" parameters:
When interval is Weekday ("w"), DateDiff returns the number of weeks between the two dates. If date1 falls on a Monday, DateDiff counts the number of Mondays until date2. It counts date2 but not date1. If interval is Week ("ww"), however, the DateDiff function returns the number of calendar weeks between the two dates. It counts the number of Sundays between date1 and date2.DateDiff counts date2 if it falls on a Sunday; but it doesn't count date1, even if it does fall on a Sunday. So what's the difference? (IMG:style_emoticons/default/iconfused.gif) |
|
|
|
May 6 2012, 01:48 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,914 From: UK |
it sounds like one counts the number of full weeks, and the other counts the number of week startdays, which may be different values.
|
|
|
|
May 6 2012, 01:50 PM
Post
#3
|
|
|
Access Wiki and Forums Moderator Posts: 48,113 From: SoCal, USA |
Hi,
(IMG:style_emoticons/default/welcome2UA.gif) I think what it's saying is that if you want to know how many intervals of "7 days" between the two dates, use "w." But, if you just want to know how many "Sundays" between the two dates, use "ww." Consider the following in the Immediate Window: ?DateDiff("w", #5/1#, #5/6#) 0 ?DateDiff("ww", #5/1#, #5/6#) 1 Just my 2 cents... (IMG:style_emoticons/default/2cents.gif) |
|
|
|
May 7 2012, 01:07 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 1,830 |
If interval is Weekday ("w"), DateDiff returns the number of weeks (periods of seven days) between the two dates.
If interval is Week ("ww"), DateDiff returns the number of calendar weeks between the two dates. A calendar week is defined by the system settings of Windows or from the fourth parameter of DateDiff. /gustav |
|
|
|
May 7 2012, 01:52 PM
Post
#5
|
|
|
New Member Posts: 3 |
Thanks, everyone. Sort of makes sense now.
|
|
|
|
May 7 2012, 03:51 PM
Post
#6
|
|
|
Access Wiki and Forums Moderator Posts: 48,113 From: SoCal, USA |
Hi,
(IMG:style_emoticons/default/yw.gif) Dave, Gustav, and I are all happy to help. Good luck with your project. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 07:13 AM |