function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Praetorian65Praetorian65 

Formula - Time difference between two dates

I am trying to create a formula field as a number. What I need to do is work out the time difference between Now and a date on my custom object rounded up to the nearest month. This would be easy to do in code but I can't work out how to do it in the formula field.
TommyTommy

Praetorian65 wrote:
I am trying to create a formula field as a number. What I need to do is work out the time difference between Now and a date on my custom object rounded up to the nearest month. This would be easy to do in code but I can't work out how to do it in the formula field.

I must be missing the key aspect of the problem, but why wouldn't it just be something like:

 

          round( (Your_Date_Field__c - today())/31,0)

 

That rounds roughly to the nearest month, so you'd have to do a wee bit more messing about to get the roundup effect you want. But the idea's the same.

 

What did I miss?

 

Praetorian65Praetorian65
Theoretically nothing, but this is to use in financial reporting so it has to be exact.