I'm using DATE2DWY(date,2) to know the week number of a date and I have a problem with date 31/12/08. This is the 53rd week of year 2008 but this function returns week number 1. This function help comment shows something like this:
If the input date to the DATE2DWY function is in a week which spans two years, the DATE2DWY function computes the output year as the year of the first day in the week. This situation is shown in the example below.
It doesn't work for year 2008 but if you try with year 2009 it works.
Does anybody know the solve of this problem?
Thanks a lot!!!
0
Comments
Should give you what you're looking for.
I'm not 100% sure, but I think this rule rules: the first Thursday of any year is in week 1.
Don't ask me why :?:
January 1 is a Thursday. That's in the same week as 31/12/08.
So 31/12/08 is in week 1 of the year 2009.
The help text seems inaccurate or incomplete.
RIS Plus, LLC
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Some countries have 53 weeks in a year (with one short week), others have 52 (with one long week). Some start counting at the 1st of Jan, some at the first day of the week, and some consider Sunday as the first day and others start at Monday.
So really any solution has to be country specific.
Unfortunately Navision is "hard coded" to the Danish standard. Personally I avoid the WEEK to DATE functions because of this issue.
The best solution is the one done in the GB version of NAV where you have multiple Accounting periods, and you can create a custom year of weeks for the country you need.
I am having the same problem with DATE2DWY function.
I cannot change the code right now. Because this function been used in so many places.
With out changing code is it possible through any changes in system calendar?
DATE2DWY(12/29/08) returns 1, should be 53
Thanks,
ravi
Did i miss the addition of more days in the year?
http://www.BiloBeauty.com
http://www.autismspeaks.org
RIS Plus, LLC
I cannot do this way, Reasons:
1. User can enter January 1st week date
DATE2DWY(01/DD/08). Here DD can be 01|02|03|04
DATE2DWY(12/29/08) is just one example I described.
DATE2DWY(12/DD/08). Here DD can be 29|30|31
2. I have to change the code many places (even I write a new function) and includes lot of testing
I have to hardcode every where; if there is no way of changing system function's behavior
Thanks,
ravi
Tell your customer how it works without a change. Then tell them how much work it will be to change it, and tell them that you may be finding areas where calculations will still be wrong because you will most likely miss a few of them. Once they know how much money it is going to be, and what kind of risk they are taking, they can make a decision whether to have you make that change or not.
RIS Plus, LLC