Articles in this section
Category / Section

How to Calculate Time Differences in Bold Reports

Published:
Updated:

In Bold Reports, the calculation and display of time differences are achieved by harnessing the capabilities of datetime functions and expressions. These functions enable the calculation of intervals between two datetime values, facilitating tasks such as determining the duration between specific events or tracking the time elapsed since a particular occurrence. Once the necessary calculations are performed, Bold Reports provides mechanisms to seamlessly incorporate these time differences into reports, offering a clear and organized visualization of the temporal data.

To calculate and display time differences in Bold Reports, follow these steps:

  1. Locate the cell in the Tablix where you want to set time difference to appear.

  2. Click on the cell to select it. In the properties panel or toolbar, find the Expression option for the cell.

  3. Click on the Expression option to open the expression editor. Enter the following expression to find the time difference and click OK.

    =DateDiff(
        DateInterval.Hour,CDATE(FormatDateTime(Fields!StartDate.Value, DateFormat.ShortDate) & " "  & Format(Fields!StartTime.Value,"hh:mm tt")), CDATE(FormatDateTime(Fields!EndDate.Value, DateFormat.ShortDate) & " "  & Format(Fields!EndTime.Value,"hh:mm tt"))
        ) & ":" &
    DateDiff(
    DateInterval.Minute,CDATE(FormatDateTime(Fields!StartDate.Value, DateFormat.ShortDate) & " "  & Format(Fields!StartTime.Value,"hh:mm tt")), CDATE(FormatDateTime(Fields!EndDate.Value, DateFormat.ShortDate) & " "  & Format(Fields!EndTime.Value,"hh:mm tt"))
    ) Mod 60
    

    Expression.png

Note: This expression is used to calculate and display the time difference between a start datetime and an end datetime, expressed in hours and minutes.

  1. Save and preview the report to see the time difference.
    Output.png

By incorporating these expressions into your report, you will be able to find the time difference in Bold Reports according to your requirements. You can find a sample report below:

TimeDifference.rdl
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied