Quarterly Date Calc

  • Thread starter Secret Squirrel
  • 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.
 
A

Arvin Meyer [MVP]

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]))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Date Calculation 2
Date Formula 3
So, where do I put the SQL? 2
Date Calc 8
Syntax error: missing operator 2
Years of Service Calculation to 2 decimal places 7
Eligible date 5
Calculate Date field 4

Top