Views:

## Scenario

Below we have listed examples of the GetWeek() function to help you understand how to use it

Each example has their result in comments.

## Formula

``````Smartflow (

SetVar('DateToCheck',CreateDate(2017, 1, 1))

ToString(GetWeek(GetVar('DateToCheck'), 0, 0) ) + 		/*	Params (2017-1-1, First Day, Sunday) Result = 1  */

ToString(GetWeek(GetVar('DateToCheck'), 0, 1) ) +		/*	Params(2017-1-1, First Day , Monday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 0, 2) ) +		/*	Params(2017-1-1, First Day , Tuesday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 0, 3) ) +		/*	Params(2017-1-1, First Day , Wednesday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 0, 4) ) +		/*	Params(2017-1-1, First Day , Thursday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 0, 5) ) +		/*	Params(2017-1-1, First Day , Friday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 6) ) +		/*	Params(2017-1-1, First Full Week , Saturday) Result = 53 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 0) ) +		/*	Params(2017-1-1, First Full Week , Sunday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 1) ) +		/*	Params(2017-1-1, First Full Week , Monday) Result = 52 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 2) ) +		/*	Params(2017-1-1, First Full Week , Tuesday) Result = 52 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 3) ) +		/*	Params(2017-1-1, First Full Week, Wednesday) Result = 52 	*/

ToString(GetWeek(GetVar('DateToCheck'), 1, 4) ) +		/*	Params(2017-1-1, First Full Week , Thursday) Result = 52 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 5) ) +		/*	Params(2017-1-1, First Four Day Week , Friday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 6) ) +		/*	Params(2017-1-1, First Four Day Week , Saturday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 1) ) +		/*	Params(2017-1-1, First Four Day Week , Monday) Result = 52 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 2) ) +		/*	Params(2017-1-1, First Four Day Week , Tuesday) Result = 53	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 3) ) +		/*	Params(2017-1-1, First Four Day Week, Wednesday) Result = 53	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 4) ) +		/*	Params(2017-1-1, First Four Day Week , Thursday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 5) ) +		/*	Params(2017-1-1,First Four Day Week , Friday) Result = 1 	*/

ToString(GetWeek(GetVar('DateToCheck'), 2, 6) )			/*	Params(2017-1-1, First Four Day Week , Saturday) Result = 1 	*/
)

``````

## Function GetWeek Parameters

The GetWeek() Function has 3 parameters, below we describe what they are.

### First Parameter

Can have any DateTime value. It is the date you want to find the Week of.

Example : 1/1/2017

### Second Parameter

Can have 3 values :: 0 , 1 or 2

0 :   Indicates that the first week of the year starts on the first day of the year and ends before the following designated first day of the week.

FirstDay = 0,

1 : Indicates that the first week of the year begins on the first occurrence of the designated first day of the week on or after the first day of the year.

FirstFullWeek = 1,

2 :  Indicates that the first week of the year is the first week with four or more days before the designated first day of the week.

FirstFourDayWeek = 2,

### Third Parameter

Can have 7 values. They Indicate which day  of the week.

Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6

# Did you know?

## North52 Helps with Complex Logic as Part of a Workflow / Power Automate Flow

The North52 Decision Suite provides functionality for you embed complex logic as part of a native Dynamics Process (Workflow/Action) or a Power Automate Flow.

Imagine if you could do an elibility check with several hundred possible combinations as part of your workflow process? You can do this easily by combining North52's Process Genie functionality with a Decision Table.

Even something as mundane as returning the next working day for your workflow (surprisingly difficult to achieve without code) can be easily done with North52.