Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Compute last day of month

Featured Replies

  • Newbies

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

)

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 )

)

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.