---
title: "Extract year from date attribute"
url: "https://openforis.support/questions/2108/extract-year-from-date-attribute"
tags: ["collect"]
status: "accepted"
score: 0
answer_count: 1
asked: "2019-01-22T12:22:06"
last_activity: "2019-01-23T09:31:00"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Extract year from date attribute

Asked by Andras on 2019-01-22

Dear OF Team,

If it is possible, how do I do that?
Would substring(string,start,len) work?

Thanks!
Andras


## Accepted answer (score 1, by Stefano (OF) on 2019-01-23)

Link: https://openforis.support/questions/2108/extract-year-from-date-attribute/2109

Hi András,  
If your date attribute is called "my_date", you can write an expression like this:  

    my_date/@year  

In the same way you can write `my_date/@month` or `my_date/@day`.  
In general, this type of expression applies to all composite attributes. If you want the survey designer to suggest the possible field names, try to write a "wrong" expression an it will give you a hint like this: `possible valid values in /sampling_point/my_date: [year, month, day]`  
Thanks,  
Open Foris Team

> Brilliant! Please add this to the IDM Expression Language help. Thanks! (Andras)
