Home > FAQ > Data Manipulation > Date Rounding in Expressions > Beginning of the current ... examples > Beginning of the current quarter (calendar year)

Beginning of the current quarter (calendar year)

This is the recommended expression for rounding dates to the beginning of the current calendar year quarter:

BOY1_DT:= (-3) #MONTHROUND A_DT &
A_DT may be either a single date (e.g., 7/16/2015, DOH, #DODEC) or an array of dates (e.g., #DATE). 

If you want to be consistent with the beginning of the current plan year quarter methodology, then we recommend this expression:

BOY1_DT:= #BEGMTH (5 #FSTBUSDAY A_DT) &
; find the first business day of the current calendar year quarter, then round that 
; first business day to the beginning of month (i.e., first day of the quarter)

We start with #FSTBUSDAY because it's the easiest way to work with plan years but can be generalized to calendar years. We then use #BEGMTH to guarantee that we are at the beginning of the quarter. 5 #FSTBUSDAY A_DT finds the first business day of the calendar year quarter, which is either the first, second, or third day of the current calendar year quarter, depending on whether the first day of the current calendar year quarter is a weekday, Sunday or Saturday. If #FSTBUSDAY returns the second or third day of the calendar year quarter, #BEGMTH converts it to the first day.