SAP Knowledge Base Article - Public

1544015 - How to extract specific day of a month in Crystal Reports?

Symptom

  • Need to create a report to return the Specific day of the month.

Environment

  • Crystal Reports 2008

Resolution

  1. The best way would be to find the first Wednesday of the month and add 14 to that date.(Note : Instead of Wednesday you can take any day)
  2. Using the below mentioned formula, we can extract the first Wednesday.
    1. DateVar MonthStart;
      DateVar FirstWed;
      DateVar ThirdWed;
       
      MonthStart := Date (Year (Today), Month (Today), 1);
       
      DayOfWeek (MonthStart);
       
      If DayOfWeek (MonthStart) = 4 Then //[Note: Here 4 indicates Wednesday, so monday=1,Tuesday=2 and so on]
          ThirdWed := DateAdd ("d", 14, MonthStart)
      Else If DayOfWeek (MonthStart) > 4 Then
              (FirstWed := DateAdd ("d", (8 - Day (MonthStart)), MonthStart);
               ThirdWed := DateAdd ("d", 14, FirstWed););
       
      ThirdWed;

Keywords

Specific day of a month, Formula in Crystal Reports , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

Crystal Reports 2008 V1