Search Results

Clear Results

Successforce Blog

Archived post “Converting Date/Time function output into HH:MM:SS”. Click here for all posts in Successforce Blog.

Converting Date/Time function output into HH:MM:SS

Spazure Silicon blogged this tip on his/her blog with the caveat that "So, even though this formula won't ever be on the CRM Best Practices Custom Formula blog, I hope somebody finds it, and finds it useful." So, mainly to prove him/her wrong, but also because it's very useful, here it is - a function to convert Date/Time into HH:MM:SS.

This particular formula was designed for cases, calculating the elapsed time in HH:MM:SS between right now and the time the case was created. As you see, I had to use the TEXT() function to convert the numerically output Date/Time function results into text, which were then fed into the Concatenate function to make everything display nicely on one field. My original version of this formula actually used multiple fields, {!Hours} {!Seconds} {!Minutes}. This made the final formula look prettier, and helped with debugging, but ultimately was impractical for distribution.

So, even though this formula won't ever be on the CRM Best Practices Custom Formula blog, I hope somebody finds it, and finds it useful. If you use my formula, please comment -- not because I want credit, but because I really do like to know where my code ends up. :-)

Text(FLOOR((NOW() - {!CreatedDate}) * 24))

&":"&Text(FLOOR(((NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() - {!CreatedDate}) * 24))* 60))

&":"&Text(FLOOR((( (NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() - {!CreatedDate}) * 24 )) * 60 - FLOOR(((NOW() - {!CreatedDate}) * 24 - FLOOR((NOW() - {!CreatedDate}) * 24 )) * 60 )) * 60 ))

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54ee3905b883300e54ee3a0558833

Listed below are links to weblogs that reference Converting Date/Time function output into HH:MM:SS:

Comments

Rachelle

This is a good formula, but most people usually want to track the elapsed time from when the case was created to when it was set to In Progress or Closed. This formula wont work there because it uses the NOW() which will increment the time output each time the record is accessed.

Spazure

You could always work with closed date and created date, if you'd prefer. That's a bit more complicated, but do-able. My blog has several variations of date and date/time formulas at http://www.ihatethebus.com.

Post a comment

If you have a TypeKey or TypePad account, please Sign In