I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as

CreatedDate < 10/31/2018

So the entire rule would read:

ISPICKVAL ( StageName, "Demo")&&

Clinical_Buyer__c = FALSE&&

CreatedDate < 10/31/2018

I keep getting the error that the '<' was expecting a DateTime received Number.

1 Answer 1


Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :

The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013

or the DATEVALUE() function, with a text parameter in ISO format:

You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:


If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():

DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 
  • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1) Commented Nov 19, 2018 at 22:30
  • You can convert the DateTime to a Date with the DATEVALUE() function, too.
    – David Reed
    Commented Nov 19, 2018 at 22:37
  • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date" Commented Nov 19, 2018 at 22:44

You must log in to answer this question.

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