Newbies Dennis Jones Posted August 29, 2007 Newbies Posted August 29, 2007 I need to calculate the date of the last day of the month a given date is in. If the date is 8/21/2007, I want the calculation to return 8/31/2007. I am using a calculated global field listed below. I get the error message "List usage is not allowed in this calculation" with the closing "]" highlighted. What am I doing wrong, or is there a better algorithm. -------------------- // To calculate the last day of the month from BLK209 date Let([ CSODate = g Date BKL209; CSODay = Day ( g Date BKL209 ); AddDays = If ( CSODay > 15 ; CSODay + 20 ; CSODay + 35 ); NextMonth = getasdate( CSODate + AddDays); NextYearNo = Year ( NextMonth ); NextMoNo = Month ( NextMonth ); ]; // end variable declarations Date ( Month ( NextMonth ) ; 1 ; Year ( NextMonth ) ) - 1 // Get the first of the next month then subtract 1 day )
Vaughan Posted August 29, 2007 Posted August 29, 2007 The date of the last day of the month is the day before the first of the next month. Date( month + 1 ; 0 ; year ) Let( [ month = Month( g Date BKL209 ) ; year = Year ( g Date BKL209 ) ] ; Date ( month + 1 ; 0 ; year ) )
Recommended Posts
This topic is 6356 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now