I have a custom field with date type. I want to use just the year from this date field for a calculation. I want to use to update a field value. I am unable to get only the year from the date field. I would like to get the year and subtract it by 10.

I used: YEAR( finish_date__c) -> It gave an error

YEAR( DATE(finish_date__c) ) -> Did not work this way too.

Any idea how I can just get the year and use it in formula?

1 Answer 1


If you're using a date field, it would be YEAR(Field__c). However, if you're using a date/time field, you need to use DATEVALUE (e.g. YEAR(DATEVALUE(Field__c)). Finally, if you're trying to display it by itself, it needs to be a number return type. To make it back into a date, you'd have to use DATE: e.g. DATE(YEAR(DATEVALUE(Field__c)), 1, 1).

  • I have date field type. When I use it in a formula to update the text of a text field. I get an error saying - Field__c may not be used in this type of formula.
    – SfdcBat
    Jan 20, 2016 at 0:43
  • I used YEAR(Field__c)
    – SfdcBat
    Jan 20, 2016 at 0:48
  • @Rdvsm In that case, I don't think we have enough information. That error is usually related to a specific field that can't be used for some reason, not a generic type of field. Furthermore, it may even depend on exactly what's going on with the text field, etc. I'm sorry, but it sounds like you need to update your question with a lot more information. I'll delete this answer in a few minutes, because it clearly doesn't help, but you need to update your question to be as specific as possible.
    – sfdcfox
    Jan 20, 2016 at 0:50
  • @Rdvsm Some fields also list as a Date, but are really a date/time. Have you tried using DATEVALUE at all?
    – sfdcfox
    Jan 20, 2016 at 0:51
  • Its a date field. I tried DATEVALUE too, but it gives the same error. The Feild__c was created as a date field. I do not see any thing different about this field. How should my questions be updated?
    – SfdcBat
    Jan 20, 2016 at 0:57

You must log in to answer this question.

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