1

My start/end date was Date and I have changed it Date/Time datatype after doing that my formula is broken:

IF(ISPICKVAL(Employee_Status__c, "ACTIVE") , 
       TODAY() >= Emp_Start_Date__c && TODAY() <= Emp_End_Date__c , FALSE)

Incorrect parameter type for operator '>='. Expected Date, received DateTime (Related field: Formula)

1

You need to cast the DateTime value into a Date for use with other Date values. Wrap your Emp_Start_Date__c field in a DATEVALUE function to cast it, or use NOW() as a comparison operator, as it returns a DateTime, which you can use without casts.

From the Working with Date and Date/Time documentation:

Date and Date/Time aren’t interchangeable data types, so when you want to perform operations between Date and Date/Time values, you need to convert the values so they are both the same type. Some functions (such as YEAR(), MONTH(), and DAY()) also only work on Date values, so Date/Time values must be converted first.

Use the DATEVALUE( date/time ) function to return the Date value of a Date/Time. For example, to get the year from a Date/Time, use YEAR( DATEVALUE( date/time ) ) ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.