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)]

1 Answer 1


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. Mar 1, 2013 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 Mar 1, 2013 at 21:17

You must log in to answer this question.

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