Round to the beginning of this or next calendar year
This example rounds a date to the beginning of this or the next calendar year depending on a calculated date.
; A_DT is a single date or an array of date(s) that you need to; adjust (e.g., DOB field or #DATE in a transformation expression)
; People are assumed to earn 1000 hours by the 176th day of each year.; So, if you work at least 176 days, then you get credit for that year
BOY_DT:= (-12) #MONTHROUND #DATE &; (-12) #MONTHROUND returns the conincident or preceding 1/1
DaysWorked:= (1+#DATE) - (DateOfHire #MAX BOY_DT) &; assume they worked on #DATE (i.e., 1+#DATE), but not before; the date of hire (DateOfHire #MAX BOY_DT)
#IF 176 > DaysWorked ; worked less than 176 days?#THEN BOY_DT ; beginning of current year#ELSE BOY_DT #DATEPLUS 1Y #ENDIF ; beginning of next year