cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
bzanos
Level III

Determine Week of Year and Day of Week Based on Year, Date and Time

Hello all,

 

My company uses a fiscal calendar where one year has only 52 work week(WW). The weeks start on Saturdays, time 19:00  (hh:mm). The day of week (DOW) is determined based on the time 19:00. 

I am trying to determine it by using Week Of Year() and Date of Week() functions but I do not get the desired outcome. 

Has anyone created JSL script to determine the week of year and date of week based on year, date and time? 

 

With example below format (dd/mm/yyy hh:mm). 

26/12/2020 18:55 (Saturdays)   ---->Year =2020, WW= 52, DOW=7

26/12/2020 19:00 (Saturdays)  ----> Year = 2021, WW= 01, DOW=1

27/12/2020 18:50 (Sunday)  ----> Year = 2021, WW= 01, DOW=1

27/12/2020 19:10 (Sunday)  ----> Year = 2021, WW= 01, DOW=2

02/01/2021 18:59 (Saturdays)  ----> Year = 2021, WW= 01, DOW=7

02/01/2021 19:00 (Saturdays)  ----> Year = 2021, WW= 02, DOW=1

:

:

25/12/2021 18:55 (Saturdays)   ---->Year =2021, WW= 52, DOW=7

25/12/2021 19:00 (Saturdays)  ----> Year = 2022, WW= 01, DOW=1

26/12/2021 18:55 (Sunday)   ---->Year =2022, WW= 01, DOW=1

26/12/2021 19:00 (Sunday)  ----> Year = 2022, WW= 01, DOW=2

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Determine Week of Year and Day of Week Based on Year, Date and Time

You should be able to get what you want by simply adding 5 hours to the Date and Time column.  Here is a formula to calculate the day of the week

Day Of Week( :Date and Time + In Hours( 5 ) )

txnelson_0-1632669821432.png

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Determine Week of Year and Day of Week Based on Year, Date and Time

You should be able to get what you want by simply adding 5 hours to the Date and Time column.  Here is a formula to calculate the day of the week

Day Of Week( :Date and Time + In Hours( 5 ) )

txnelson_0-1632669821432.png

 

Jim
bzanos
Level III

Re: Determine Week of Year and Day of Week Based on Year, Date and Time

Jim. Thank you.