# Weekday and WeekNum functions in Power Apps

## 1. Weekday function in Power Apps

The Weekday function returns the weekday of a Date/Time value.

Power Apps Syntax Weekday(DateTime [, StartOfWeek ] )

- DateTime – It is the required parameter. It specifies the Date/Time value to operate on.
- StartOfWeek – It is an optional parameter. It specified which day of the week taken as the start day of the week. If it is not specified, then by default the start day of the week is Sunday.

The following table list the values and their description for the StartOfWeek parameter:

StartOfWeek Parameter | Description |
---|---|

StartOfWeek.Sunday | It returns number 1 for Sunday through 7 for Saturday. This is the default. |

StartOfWeek.Monday | It returns number 1 for Monday through 7 for Sunday. |

StartOfWeek.MondayZero | It returns number 0 for Monday through 6 for Sunday. |

StartOfWeek.Tuesday | It returns number 1 for Tuesday through 7 for Monday. |

StartOfWeek.Wednesday | It returns number 1 for Wednesday through 7 for Tuesday. |

StartOfWeek.Thursday | It returns number 1 for Thursday through 7 for Wednesday. |

StartOfWeek.Friday | It returns number 1 for Friday through 7 for Thursday. |

StartOfWeek.Saturday | It returns number 1 for Saturday through 7 for Friday. |

Example: For the following example, the current date is Friday, April 21, 2015.

a) The expression returns the current day of the week in the format of a number from 1 (Sunday) to 7 (Saturday). We can replace Today() with any other date value that we want to retrieve the day of the week for.

Power Apps Formula

b) The second argument specifies the start day of the week.

Power Apps Formula

c) The excel code 14 specifies the start day of the week is Thursday.

Power Apps Formula

## 2. WeekNum function in power apps

The WeekNum function in Power Apps is used to return the week number of a specified date based on a specified start day of the week.

Power Apps Syntax WeekNum(Date [, StartDayOfWeek])

The function has the following parameters:

- Date: Required. A date or date/time value that we want to find the week number of.
- StartDayOfWeek: Optional. An integer that specifies the day of the week that the week starts on. The default value is 1, which represents Sunday. Other values are 2 for Monday, 3 for Tuesday, and so on.

Example: Here is an example of how to use the WeekNum function:

Power Apps Formula

This will return the week number of April 21, 2023, assuming that the week starts on Monday (the second day of the week). The result will be a number between 1 and 53, depending on the week of the year.