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
peteppetep 

Calculate days from CreatedDate to Today

Hi,

 

What's the formula to calculate the difference of the days?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
SwarnasankhaSwarnasankha

The Today() function returns a Date value whereas the CreatedDate returns a Date/Time value. So what is required is for you to convert the Date/Time value into a Date value and perform a simple subtraction between the two values.

 

Try this : TODAY() - DATEVALUE(CreatedDate)

 

Hope this helps you.

All Answers

SwarnasankhaSwarnasankha

The Today() function returns a Date value whereas the CreatedDate returns a Date/Time value. So what is required is for you to convert the Date/Time value into a Date value and perform a simple subtraction between the two values.

 

Try this : TODAY() - DATEVALUE(CreatedDate)

 

Hope this helps you.

This was selected as the best answer
peteppetep

Thanks!