Select Page

A new knowledge base article has been published on our support portal.

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 	*/
 )

 

View this article in full on our support portal