KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: A utility method that returns the last date of the month
PRODUCT: 4D | VERSION: 12.2 | PLATFORM: Mac & Win
Published On: June 3, 2011

Here is a simple method that takes a date value and converts it into the last date value of the same month.

 // Method: UTIL_LAST_DATE_THIS_MONTH
 // Description
 //   Return the name of the last date of the month
 // Parameters
 //   $1 - Date
 // Return
 //   $0 - Last date of the month
 // ----------------------------------------------------
C_DATE($0;$1;$date_d)
If (Count parameters>=1)
  $date_d:=$1
  $0:=Add to date(Add to date($date_d;0;0;-Day of($date_d)+1);0;1;-1)
End if