Function Dates Times Class

FirstDayOfPeriod

Return the first day of the period (for example, the first day of the quarter), given a date within the period and the number of periods per year.

Signature (Visual Basic / VBA)

Public Function FirstDayOfPeriod( _
      ByVal vDate As Variant _
    , ByVal vPeriod As Variant _
    ) As Variant

Code Example

    FirstDayOfPeriod(#12/15/99#, 1) = #1/1/99#
    FirstDayOfPeriod(#12/15/99#, 2) = #7/1/99#
    FirstDayOfPeriod(#12/15/99#, 4) = #10/1/99#
    FirstDayOfPeriod(#12/15/99#, 6) = #11/1/99#
    FirstDayOfPeriod(#12/15/99#, 12) = #12/1/99#

Parameters

Parameter Description
vDate The date used to determine the period. Function returns Null if vDate is Null or cannot be fixed up to a Date.
vPeriod The number of periods per year. Use 1 for an annual period, 2 for semi-annual, 3 for four-month period, 4 for quarterly, 6 for bi-monthly, and 12 for monthly. vPeriod must be one of these numbers or else the function will return unpredictable results. Function returns Null if vPeriod is Null or cannot be fixed up to a Date.

Notes & Version History

v2.0 Addition This function is new to this version of Entisoft Tools.