cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

computation for calendarweek (ISO-8601)

JensN.
13-Aquamarine

computation for calendarweek (ISO-8601)

Hi @all,

my users want to see which calendarweek it is, if they set a special date in an integrity-item. Since the built-in functionality to get the calendarweek (weekofyear) from a date doesnt work as it should do for ISO-8601 i tortured my brain for an alternative, and (with help of my colleagues) here it is:

floor((DayOfYear(<datefield>)+(mod(-5+(-DayOfWeek(<datefield>)),7)+2))/7)+1

There are some weird things in this formula, especially the modulo-part with its positive/negative signs, but without this or with a more simple notation it doesnt work (at least here). Another small drawback: In years with a short first week the first days are in week 52 or 53 from the last year. Above formula doesnt calculate the year, and these first week is labeled as week 0.

How to use: put the formula into the computation area of an integer field, thats it.

Maybe its useful for someone else, and maybe someone can show me a better way to get ISO-calendarweeks in Integrity.

cheers, Jens

0 REPLIES 0
Top Tags