Would this give me the Calendar Quarter (ie, January 1st, April 1st, July 1st or October 1st)?
Example: date given is Today (08/11/2009 08:30:40)
Combo2.text = 2
Combo1.text = Quarter
Result should = 01/01/2010 08:30:40
Example2: date given is Today (08/11/2009 08:30:40)
Combo2.text = 3
Combo1.text = Quarter
Result should = 04/01/2010 08:30:40
I hope that helps explain better...
Main Topics
Browse All Topics





by: HooKooDooKuPosted on 2009-08-11 at 11:30:39ID: 25071901
Well, you've already got a good start utilizing the functions DateSerial, Year, Month, and Weekday.
The only thing that seems to be missing is tryig to find that "start" of a quarter to then add 3 months multiplied by the number of quarters you want.
Try something like this...
sResult = DateSerial( Year(sDate), 1 + 3 * iQuarter + 3 * ((Month(sDate) - 1) / 3 ), 1)
The idea is that "(Month(sDate) - 1)/3" gives you a number from 0 to 3 (0 for 1st quarter, 3 for 4th quarter). Multiply that result by 3 and add 1 to get the 1st month of the quarter of sDate. Then just add three months for each quarter desired.