firstweekofyear

aziz rasul

Active member
Local time
Today, 02:42
Joined
Jun 26, 2000
Messages
1,935
I'm using the DateDiff to calculate various values. I've got everything to work. However I don't know what influence the firstweekofyear has on a calculation. Whatever value I try i.e. 1,2 or 3 I get the same answer. However further in the future I may have a problem because I don't know what affect the firstweekofyear could have.

Can anyone give me an example where changing the firstweekofyear value gives me a different answer.

While I'm on the subject, what is the difference in using the "d" interval symbol as opposed to the "y" symbol.
 
Last edited:
The only difference between y and d is that y represents the day position in the year and d represents the day position in the month. The distinction becomes clear when you use these with the format function

Code:
?format(#4/03/03#,"y")
93
?format(#4/03/03#,"d")
3

However, when using this with the DateDiff function, there is no real difference between y and d (they both return the distance between the dates measured in days). I believe they allowed both for the sake of consistency.

As for the difference that firstweekofyear makes, the only thing that I know for sure is that if it were to make a difference it would only be when you are dealing with a week interval. I did some testing and couldn't produce a different result though. Again the real difference comes out if you play with it when you use the format function. Compare the following:

Code:
?format(#12/31/03#,"ww",,vbFirstFullWeek)
52
?format(#1/1/03#,"ww",,vbFirstFullWeek)
52

?format(#12/31/03#,"ww",,vbFirstJan1)
53
?format(#1/1/04#,"ww",,vbFirstJan1)
1

However, even with the vbFirstJan1 option, DateDiff results in 0 for both examples. It must know that there is not a full week between the dates regardless of the selection you make. It may be an option for the sake of consistnecy with the format function again, but I am not positive about this.
 
I see from what u say that it is mostly a compatability issue with the Format function.
 

Users who are viewing this thread

Back
Top Bottom