Rounding date forward
E.Heizyk
Forums
Hi,
I am looking to add a number of days to a given date to calculate an eligible date then round it to the first of the following month to get an entry date.
DOH: 3/5/2001
Eligible Date: 6/3/2001
Entry Date: 7/1/2001
The eligible date does not need to be an output, just the entry date.
I currently have:
@daystod(@DToDays(DOH)+90)
this is giving me the correct elibile date, but I cannot figure out how to round it to the first of the next month.
thanks!
Hello,
Hello,
Date can always be a challenge. I created a custom function (attached) that will take a date and return the first of the next month. Because of the formatting issues in different languages the custom function accepts the date as a character and returns a character string of the date. So you need to use the @CtoD and @DtoC with this custom function. Following is some example code for your funcation above.
@ctod(#Find1stOfNextMonth(@Dtoc(@DaysToD(@DToDays(DOH) + 90) , "yyyymmdd")), "YYYYMMDD")