Function 1: Function which determines Fiscal Week number of a given year
Function 2: Get the correct Week number of a given Date (use after Function 1 is available)
Function 1: Suggest a function which returns the fiscal year week number.
Fiscal year starts differently for everyone which is a reason for value.
Function 1 syntax should include considerations for the following:
1. Which year. This is necessary to determine leap years
2. Start month of Fiscal Year
3. Which day of the week does the week begin? I.e. Sunday, Monday, etc.
Resources:
ISO 8601 sets a standard for numbering weeks in a year.
Stack OverFlow has a jump point for C# code
https://stackoverflow.com/questions/111 ... given-date
Function for Fiscal Week Numbering
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Function for Fiscal Week Numbering
I'd imagine this can be achieved with DateDiff, if I understand correctly.
Yes, we have a Custom Scripting Service. Message me or go here
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Function for Fiscal Week Numbering
Something along these lines should be enough to get you started :
Code: Select all
//Get Today's date
GetDate>today
//Set the year start
Let>YearStart=2020-04-23
//How many weeks have elapsed?
Datediff>today,YearStart,W,WeekNumber
MDL>Week Number %WeekNumber%
//What day of the week was the year start. Credit : JRL.
VBEval>WeekdayName(Weekday("%YearStart%",0)),vDayoftheWeek
MDL>%YearStart% was a %vDayoftheWeek%
Yes, we have a Custom Scripting Service. Message me or go here
Re: Function for Fiscal Week Numbering
Thought I'd share this: If its posted in the wrong place, I can repost in the tech scripts
Special Thanks to Dorian for the direction and code
Variable WK returns the week
Variable FY returns last two digits of the year
Special Thanks to Dorian for the direction and code
Code: Select all
//Get Today's Date
getDate>Today
//Get Current Year
Year>FYear
//Add One Year for current FY ---
DateAdd>Today,Y,1,FY2
//Grab Just the Year Part
DatePart>%FY2%,Y,FY3
//Grab Last Two digits of four digit year
MidStr>%FY3%,3,2,FY
//
//Uncomment line below for Modal to display FY result
//MDL>Year is %FY% Week is %WK%
//
//Set FY Year Start
Let>FYearStart=2020-07-01
//How Many Weeks have lapsed?
DateDiff>Today,FYearStart,W,WK
Variable WK returns the week
Variable FY returns last two digits of the year