Calc Week of Year

Hi all I didnt find anything helpfull through the Search-Function so it comes here fg: I have Date like 04.06.2003 (German) and now i want to know which Week of the year this date is! Can somebody help? Thank you!

DATE2DWY Returns the day of the week, week number, and year based on the input date. Number := DATE2DWY(Date, What) Number Data type: integer The resulting day of the week, week number, or year. Date Data type: date The input date. What Data type: integer Tells the system what the function should return. The valid options are 1, 2, and 3. This value… Corresponds to… 1 Day of the week (1-7, Monday equals 1) 2 Week number (1-53) 3 Year Comments 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. Example This example shows a special case which occurs when you use the DATE2DWY function in a week which spans two years. D := 010194D; DayOfWeek := DATE2DWY(D, 1); WeekNumber := DATE2DWY(D, 2); Year := DATE2DWY(D, 3); MESSAGE(Text000 + Text001 + Text002 + Text003, D, DayOfWeek, WeekNumber, Year); Create the following text constants in the C/AL Globals window: Text Constant ENU Value Text000 ‘The date %1 corresponds to:’ Text001 ‘The day of the week: %2’ Text002 ‘The week number: %3’ Text003 ‘The year: %4’ The message window shows: The date 01/01/94 corresponds to: The day of the week: 6 The week number: 52 The year: 1993 This example shows that the system regards the date 01/01/94 as day number 6 (Saturday) in week number 52 in the year 1993.

Hi Benjamin From the Navision help [;)]

quote:


DATE2DWY Returns the day of the week, week number, and year based on the input date. Number := DATE2DWY(Date, What) Number Data type: integer The resulting day of the week, week number, or year. Date Data type: date The input date. What Data type: integer Tells the system what the function should return. The valid options are 1, 2, and 3. This value… Corresponds to… 1 Day of the week (1-7, Monday equals 1) 2 Week number (1-53) 3 Year


bye André

Did already that Andre… btw, how are you mate?

quote:


Originally posted by eromein
Did already that Andre… btw, how are you mate?


Only seconds, boy [8D]. (I had to start Navision first [}:)]). Thank you I’m fine. And you?

You know how I am… Always one second quicker!

Hi Benjamin I you want to show the week only on reports or forms you can also use Format. 'Week '+FORMAT(Today(),0,'<Filler Character,0><Week,2>') = '**Week 20**' bye André

Well guys you may be right but if Amargosa wants the Accounting week, when the year (week 1) starts in say November and the week might start on a wednesday you would have to find it using the accounting period table (3.60)and date functions. Never as simple as it first looks! [:D] [:I] [;)]

quote:


Originally posted by David Cox
… Accounting week …


Never heard this [:p].

quote:


Originally posted by Amargosa
… I have Date like 04.06.2003 (German) and now i want to know which Week of the year this date is! …


For me this sounds like calendar year. But perhaps Benjamin can enlighten us what he is searching for [:)]. Another way to find the week would be to look on the calendar on the wall in front of you like in my office[:D]. bye André

Hey thank you! Sure - forgot to take a look into the helpfile [B)]

quote:


Originally posted by Andre DDB

[quote]
Originally posted by David Cox

… Accounting week …


Never heard this [:p].

[quote]
Originally posted by Amargosa
[:o)] Might be that you are still using 1.1x, In Attain G/L Setup, Calendar Setup. You can setup your own Week, Month, Quarter & Year so you now can have 4-4-5 Accounting with the week starting on any day you like. Then you can say do not “Use System Week” Month, Quarter and year. Accounts schedule will now calculate a week from Wendnesday if you want, the month as 28 or 35 days if you use Accounting Calendar & 4-4-5 Accounting, also you can create 4 Quarters with the same starting day of the week and the same number of days, which is good for analysis! Being that Navision is an accounting package this is all quite positive!! [:D][:D][8D][:p]

Hi David Sorry for misleading you but the meaning of my sentence was: Even though I’m coming from the accounting/controlling side I’ve never heard something about a ‘Posting Week’ as period.[8D] btw. Do you talk about the Accounting Periods? How much sense makes a weekly period [;)]? bye André

quote:


Originally posted by Andre DDB
Hi David Sorry for misleading you but the meaning of my sentence was: Even though I’m coming from the accounting/controlling side I’ve never heard something about a ‘Posting Week’ as period.[8D] btw. Do you talk about the Accounting Periods? How much sense makes a weekly period [;)]? bye André


Hi André Yes I do mean Accounting Periods In the UK retail sector most companies prefer to use a 4-4-5 reporting system giving 13 week quarters of 91 days. Comparing “Accounting Months” Periods 1,2,4,5,7,8,10,11 will all have 28 days, 3,6,9,12 will have 35 days, calendar periods are not good for retail reporting, starting on different days each year and having unequal number of days. The accounting year will have 364 days. This allows for all period like for Like reporting. As for the weekly “Accounting Period” some retail companies also like the week to start on a Saturday or Sunday and not the monday, not sure why? [:I], but if we was bringing on compressed historic data for comparing and the old systems week started on a different day would be one reason, might be that someone in the retail sector can answer that one?. Regards

Hi David Thank you for the explanation [:)]. As I always said: You have to learn something new every day [8D]. bye André