Jump to content
  • 0

Time Calculations


Corpcatalog

Question

3 answers to this question

Recommended Posts

  • 0
Hello Corpcatalog!

 

There is a standard date function "Datediff".

You can create a Calculated field, add this function in format

 

Datediff (datepart, startdate, enddate)

 

Startdate and enddate are fields, datepart - is unit dimensions (year, month, day, hour, minute, second).

E.g., my formula is:

Datediff(hour,[@field:startingDate],[@field:endingDate])

 

To display the sums of the times - add an Aggregate field, select the created Calculated Field and select the "Sum" in the function field.

You can also use Formula in the Aggregate field.  E.g., if datepart is hour, and I want see result in days, the Formula will be like SUM/24.

 

Some more details about Calculated and Aggregate fields.

Link to comment
Share on other sites

  • 0

Hi, you may also want to consider this formula with HH:MM format : 

CONVERT(VARCHAR,(Datediff(minute,[@field:Start_date],[@field:End_date])/60))
+':'+
CASE WHEN (Datediff(minute,[@field:Start_date],[@field:End_date])%60) < 10 THEN '0'+CONVERT(VARCHAR,(Datediff(minute,[@field:Start_date],[@field:End_date])%60))
ELSE
CONVERT(VARCHAR,(Datediff(minute,[@field:Start_date],[@field:End_date])%60))
END 
 
And refer to this article for the function reference: 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...