DateUtilsWeekFromDate Method

This can be used to determine the week of the year in which a specified date falls

Definition

Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public static int WeekFromDate(
	DateTime weekDate,
	DayOfWeek dow
)

Parameters

weekDate  DateTime
The date to use when determining the week
dow  DayOfWeek
The day on which a week starts

Return Value

Int32
Returns a week number between 1 and 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 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