cancel
Showing results for 
Search instead for 
Did you mean: 

Last day of current month custom function

Former Member
0 Kudos

I am looking for a custom function to make it easy to get the last day of the current month. I know there is one available called LASTDAYOFMONTH and that you can get it if you use the Crystal repository but I don't. In the past I was able to download these custom functions as dll's from BO's support site but that does not seem possible any more (I searched the SAP site high and low). There are other threads about this where article 305 from the old BO support site are being referenced but again those links does not work any more. Is there any way to download this custom function and add it to CR II release 2?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

There are many variations that you can use to get it.

I typically use this:

Dateadd("m",1,minimum(monthtodate)) - 1

Answers (3)

Answers (3)

Former Member
0 Kudos

You don't need the repository to have functions. I've created several, placed them all in the Report Functions of a blank report, and use that report as a "template" for new reports.

Here is an End of Month function.

Function (DateVar Tdate)

// EOM End of Month returns the last day of the month of the entered date

// INPUT: Tdate the target date

// OUTPUT: Last day of the month

// Example: EOM(2/19/2003) = 2/28/2003)

local numbervar YY := (if Month(Tdate) < 12 then Year(Tdate) ELSE Year(Tdate)+1);

local numbervar MM := (if Month(Tdate) < 12 then Month(Tdate)+1 else 1) ;

Date(YY,MM ,1 ) -1 ;

fritzfeltus
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pieter,

Try this code to return the last day of the current month:

DateSerial(Year(currentdate), 1 + Month(currentdate), 0)

No need for custom functions or UFLs.

Cheers,

Fritz

Former Member
0 Kudos

This seems to work fine. I use the maximum (lastfullmonth) a lot to get the last day of the previous month but never needed to get the last day of the current month so this will be very helpful.

Thanks

Former Member
0 Kudos

Hello Pieter,

please try here

[Business Objects Support Software Downloads|https://websmp106.sap-ag.de/bosap-supportsw]

Service Packs - a collection of patches and updates combined into a single package for ease of installation.

Hot Fixes - Includes monthly hot fixes, critical hot fixes and fix packs.

Utilities - Including runtime packages, which are used in the deployment of applications using the Crystal Reports SDKs for Visual Studio.

Samples - Sample reports and applications that demonstrate report design concepts and development.

Falk