Quarterly Date Calc

  • Thread starter Thread starter Secret Squirrel
  • Start date Start date
S

Secret Squirrel

I need to calculate a date in my query based on the hiredate of my employees.
I need to add 6 months to their hiredate but then I need to find the first
day of the next quarter after that 6 months. For example if an employee was
hired on
1/15/08 then I need the result to be 10/1/08.
 
Use this function with the DateAdd () function:

Function StartOfNextQuarter(D As Variant) As Variant
If VarType(D) <> vbDate Then
StartOfNextQuarter = Null
Else
StartOfNextQuarter = DateSerial(Year(D), Month(D) - (Month(D) - 1) Mod 3
+ 3, 1)
End If
End Function

StartOfNextQuarter(DateAdd("m",6,[HireDate]))
 
Back
Top