SFDC Documentations tells me YEAR "Returns the year component of a Datetime in the local time zone of the context user".


When I try to use "YEAR(Datetime__c)" in a workflow criteria I recieve error...

"Incorrect parameter type for function 'YEAR()'. Expected Date, received DateTime"

Can YEAR() be used to with a DATETIME as it can with DATE [e.g. YEAR(Datetime__c)]


Try using:


You are correct, YEAR() can not be used with a DateTime object. You need to convert that DateTime object to a Date beforehand using the DATEVALUE() formula.

  • That works - Thanks! I guess I can reach out SFDC why their documentation says otherwise. – Justin J Carlson Mar 1 '13 at 20:01
  • 1
    Their documentation is correct. You are looking at methods on the DateTime class in Apex. What you should be looking at are the formula functions - salesforce.com/us/developer/docs/pages/Content/… - Look under the Date and Time Functions section – Jesse Altman Mar 1 '13 at 21:17

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.