Symptom
How to Display time on X-Axis of the chart in HH:MM format?
Environment
- Crystal Reports 2008
- Crystal Reports XIR2
Resolution
- Create a Formula named Time as given below:
if (hour({Table_Name.TIME})>12)
then totext({Table_Name.TIME}, "HH:MM") + "pm"
else if (hour({Table_Name.TIME})=12) and (minute({Table_Name.TIME})>0)
then totext({Table_Name.TIME}, "HH:MM") + "pm"
else if(hour({Table_Name.TIME})=12) and (minute({Table_Name.TIME})=0) and (second({Table_Name.TIME})>0)
then totext({Table_Name.TIME}, "HH:MM") + "pm"
else
totext({Table_Name.TIME}, "HH:MM") + "am";
2. In the chart expert, Insert this formula (Time) under "On change of" section
3. Take another field which needs to be on the Y-axis under "Show value(s)" section.
4. Click on OK in the cHart expert.
5. You will get the time value appearing on X-axis in HH:MM am/pm format as shown below:
Note: In the chart shown above, name of the formula is Test which is on X- Axis.
Keywords
Time, X-Axis, HH:MM format, Chart, Crystal Report , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To