TODAY() - DATEVALUE(CreatedDate), 
    Implemented_Date__c - DATEVALUE(CreatedDate)

I keep getting this error message:

Error: Incorrect parameter type for operator '-'. Expected Number, DateTime, received Date

what could be the challenge and this is a trailhead challenge.

1 Answer 1


Date and DateTime are closely related, but they are separate data types.

Generally speaking, when you have an operator (like addition, subtraction, less than, etc...), both of the operands need to be of the same type. Apex (Salesforce's proprietary, java-like programming language) can be a bit more flexible, but you're working with a formula ...which is not Apex.

TODAY() returns a Date.
CreatedDate (contrary to its name) is a DateTime. You appear to be handling this correctly by turning it into just a Date (via the DATEVALUE() function). In other words, you need to make sure that the data "type" matches.

So, given your error, the only possibility I see is that Implemented_Date__c is a DateTime instead of a Date. If you turn it into a Date using DATEVALUE() (like you did with CreatedDate), then the formula ought to save without complaints.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .