# Write Year Function

**URL:** <https://forum.dimagi.com/t/write-year-function/4879>\
**Category:** Uncategorized\
**Created:** [January 15, 2018, 6:39pm UTC](https://forum.dimagi.com/t/write-year-function/4879 "2018-01-15T18:39:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mawatta](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/m/96bed5/32.png) [@Mawatta](https://forum.dimagi.com/u/Mawatta)\
**Post date:** [January 15, 2018, 6:39pm UTC](https://forum.dimagi.com/t/write-year-function/4879/1 "2018-01-15T18:39:28Z")

</div>

Hi,  
I want to know there is a **Year function** in CommCare in to order to extract part of a date field. If it is possible, please help me I need it. I want to extract a year from a date field.

---

<div class="post-metadata">

**Author:** ![Aliza\_Stone](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/a/7c8e57/32.png) [@Aliza\_Stone](https://forum.dimagi.com/u/Aliza_Stone)\
**Post date:** [January 15, 2018, 6:56pm UTC](https://forum.dimagi.com/t/write-year-function/4879/2 "2018-01-15T18:56:04Z")

</div>

You can use the format-date() function for this, which is documented in detail here: [CommCare Functions - CommCare Public - CommCare Public](https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-format-date)

---

<div class="post-metadata">

**Author:** ![Mawatta](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/m/96bed5/32.png) [@Mawatta](https://forum.dimagi.com/u/Mawatta)\
**Post date:** [January 15, 2018, 8:40pm UTC](https://forum.dimagi.com/t/write-year-function/4879/3 "2018-01-15T20:40:17Z")

</div>

Thanks Aliza for the support. It was very help to me.
