Search code examples
crystal-reports

Is there a quick and easy way to print the end of the month date on a crystal report?


I am building a really simple report in Crystal Reports and we need it to print the last day of the month, based off the month it is being printed in.

I would assume that Crystal has some way of doing this due to the "Special fields" like Print Date. Or am I going to have to write an if-then-else?


Solution

  • another way you can get the end of the month printed in your report is using this formula

    dateserial(year(currentdate),month(currentdate)+1,1-1)
    

    it will give you last day of current month, if you need a month before just subtract 1 in this part of the code month(currentdate)+1 and for a month after add 1 instead and so on and so forth