DateUtilsWeeksInYear Method

This is used to determine the number of weeks in a year

Definition

Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public static int WeeksInYear(
	int year,
	DayOfWeek dow
)

Parameters

year  Int32
The year in which to get the week count
dow  DayOfWeek
The day on which a week starts

Return Value

Int32
Returns the week count (52 or 53).

Remarks

A week is defined as a seven day period starting on the specified day of the week. The first week of the year is defined as the one starting on the specified day of the week and containing at least four days of the year.

Not all years will have a 53rd week. For example, assuming a Monday week start, week 53 can only occur when Thursday is January 1st or if it is a leap year and Wednesday is January 1st.

See Also