Date UtilsCalculate Fixed Date Method
This method is used to calculate the date on which a fixed day occurs (for example, July 4th).
However, it adjusts the date to the preceding Friday if the date falls on a Saturday or the following
Monday if the date falls on a Sunday.
Definition
Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
Returns a DateTime object that represents the date calculated from the settings adjusted if necessary so that it does not occur on a weekend.
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
C#
public static DateTime CalculateFixedDate(
int year,
int month,
int day
)VB
Public Shared Function CalculateFixedDate (
year As Integer,
month As Integer,
day As Integer
) As DateTimeC++
public:
static DateTime CalculateFixedDate(
int year,
int month,
int day
)F#
static member CalculateFixedDate :
year : int *
month : int *
day : int -> DateTime Parameters
- year Int32
- The year in which the day occurs
- month Int32
- The month in which the day occurs
- day Int32
- The day of the month on which the day occurs
Return Value
DateTimeReturns a DateTime object that represents the date calculated from the settings adjusted if necessary so that it does not occur on a weekend.
Remarks
The FixedHoliday class uses this method to calculate the date on which a
holiday is observed rather than the actual date on which it falls when its
AdjustFixedDate property is set to true (i.e. to calculate holiday dates
for a business).
Example
C#
// Returns 07/04/2003 (7/4 falls on a Friday).
dtDate = DateUtils.CalculateFixedDate(2003, 7, 4);
// Returns 07/05/2004 (7/4 falls on a Sunday so it adjusts it forward
// to the Monday).
dtDate = DateUtils.CalculateFixedDate(2004, 7, 4);VB
' Returns 07/04/2003 (7/4 falls on a Friday).
dtDate = DateUtils.CalculateFixedDate(2003, 7, 4)
' Returns 07/05/2004 (7/4 falls on a Sunday so it adjusts it forward
' to the Monday).
dtDate = DateUtils.CalculateFixedDate(2004, 7, 4)C++
No code example is currently available or this language may not be supported.F#
No code example is currently available or this language may not be supported.