DateToPeriod

ACCPAC Common Controls

AccpacFiscalCalendar.DateToPeriod

Calculates the period number, given a date, period type and length, and a base date.

Function DateToPeriod(
  Date As Date,
  PeriodType As tagPeriodType,
  PeriodLength As Integer,
  BaseDate As Date,
  Period As Integer) As Boolean

Parameters

Date

[in] the date

PeriodType

[in] the period type

PeriodLength

[in] the period length

BaseDate

[in] the starting date of the first period

Period

[out] returns the period number that contains the specified date

Return Value

Returns whether the period number was successfully determined.

Remarks

Use a combination of period type and length to denote additional period types.

Examples:

    • Bimonthly:
      PeriodType = PERTYPE_MONTHLY, PeriodLength = 2

    • Biweekly (with Sunday = day 1):
      PeriodType = PERTYPE_WEEKLY, PeriodLength = 14