YearWeek Trouble

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

Access 2000 on Win2000Pro

Check it out ...run this query:

SELECT
DatePart("yyyy",#1/1/2004#,1,2) & "wk" &
Format(DatePart("ww",#1/1/2004#,1,2),"00")
AS YearWeek;

....You get "2004wk53" ...not quite right (should be "2003wk53")

Am I going to have to write something to check
if month = 1 and week >52, then year = year-1 ???

There has to some way to get the right year--where the first week of the
year must have 4
days...
 
I suspect the problem is semantics. The 2 sets the value for "first week of
the year" and when you ask for "week of the year" you get the answer you
expect, 53. However, in the first statement you are asking for which "year"
1/1/2004 is in, not "week of year", so I suspect the argument is ignored.

The help file states "The first day of week argument affects calculations
that use the "w" and "ww" interval symbols." It doesn't mention "first week
of year", but I suspect that the same rule applies to this as well, as
mentioned above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top