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
JulieMJulieM 

Calculating Age in Custom Object.

I am having problem calculating the age on a custom object.
 
This is my formula:
IF({!Fulfillment_Completion_Date__c}, ROUND ({!Fulfillment_Completion_Date__c} - {!CreatedDate} , 0) ,
ROUND(( TODAY() - {!CreatedDate}),0))
 
Here is the error I am getting:
Error: Incorrect parameter for function -. Expected Number, Date, received DateTime
 
 
Can anyone help me fix this?
 
Thanks in advance,
Julie
TonkaCruiserTonkaCruiser

Your Created Date is a Date/Time field and isn’t usable in that formula.  You will need to create a formula(date) field and put the {!CreateDate} value in it.  This will remove the time value on that field.  You can leave this field off of the page layout so your users don’t see it.  You will then want to use this {!DateOnly} field in the formula.  That should solve this.

 

Chris

EricBEricB
In Winter '07 we are introducing a new function called DATEVALUE() that will allow you to convert a datetime field like {!CreateDate} to a date in one fell swoop.

So you can do stuff like

{!MyDate__c} - DATEVALUE( {!CreateDate} )

Cheers,
Eric Bezar
salesforce.com Product Management


ShalayShalay

I'm attempting to create an age field for my Custom Object, but I'm having trouble translating the suggestion give in this comment into my formula...Please help!

 

 

Thank you,

Shalay Owens