Skip to Content
author's profile photo Former Member
Former Member

Last day of current month custom function

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2008 at 12:33 PM

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

    I typically use this:

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2008 at 08:24 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 23, 2008 at 11:01 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2008 at 05:02 PM

    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 ;

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.