Crystal Reports - display sum of date and year

Posted on 2009-04-09
Last Modified: 2012-05-06
I have been following the guide at to create a calendar style report.

I would like to tweak it slightly, the date is displayed by summing a formula, the formula is

if DayOfWeek ({}) = 1 then Day({})

which has the effect of displaying the correct date.

What I would like it to also display is the year so that instead of just saying 01, it says 01 January.

The date field that it calls from contains the month.

Thanks Ed.
Question by:edmacey
  • 4
  • 2
LVL 10

Expert Comment

ID: 24106018
Change it to this:
if DayOfWeek ({}) = 1 then Date({})

Then format your field to only display it as 1-Month


Author Comment

ID: 24106166
It doesn't like that, I have changed first dayofweek to be monday. how do i change the sum by adding 1-month in there?
LVL 10

Accepted Solution

Spykair earned 500 total points
ID: 24106240
Your formula will be:
if DayOfWeek ({}) = 1 then Date({})

Then place the formula field in the report.
Right click on the formula field -> format field -> select the date mask that will show "1-Mar' or something like that.

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 24106916
Okay thanks, I can get that to work if I were using those fields in the report however I am taking summaries of them which are numbers and can't be represented as dates.

Author Comment

ID: 24107044
Actually I  can now get that to work fully, except it doesn't seem to accept my CrMonday criteria to make Monday the first day of the week.

if DayOfWeek({caldates.Date},CrMonday) = 1 then Date({caldates.Date})

Author Closing Comment

ID: 31568439
User error with the previous ones, it was my own fault it wasn't working, got it working now. thanks ed.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question