DateUtilsCalculateFixedDate 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.
Namespace: EWSoftware.PDIAssembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public static DateTime CalculateFixedDate(
int year,
int month,
int day
)
Public Shared Function CalculateFixedDate (
year As Integer,
month As Integer,
day As Integer
) As DateTime
public:
static DateTime CalculateFixedDate(
int year,
int month,
int day
)
static member CalculateFixedDate :
year : int *
month : int *
day : int -> DateTime
- 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
DateTimeReturns a
DateTime object that represents the date calculated from the
settings adjusted if necessary so that it does not occur on a weekend.
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).
// 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);
' 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)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.