Bug in function DATE2DWY ?!?!

What do you think will DATE2DWY(311207D,3) return? 2007? Wrong, it returns 2008. Why?!?!?

Actually, it is correct!

As DATE2DWY(311207D,2) = 1 (week #1) - the year has to be in the next year.

[:)] Tricky, but logical!

Thanks!

Any idea how I can get the year of a specific date? (Year end is 31.12. and regardless of the week it is in the old year).

please use DATE2DMY instead of DATE2DWY.

or use

EndDateofhtyear := CALCDATE(’’,Dateoftheyear); (not tested)

br
Josef Metz

Be careful using DATE2DWY, weeks are not uniformly handled in all countries. Some countries consider that there are 52 weeks in the year, some countries count 53. Navision does it the Danish way, it is not localized to your country. Thus the first day of the year could be in one country week 53, in another week 1 thus the year returned is a bit odd, but correct.