How to get only year value in the date field


I created a date field and set the appearance “year” to show only the year calendar to choose from. However, after selecting the year and submit the data input shows the whole date, for example Jan 1, 2022

How to get only year value?


@chenboly, did you follow this approach discussed previously:

I did that and can select only year, but after input the data it is capture the date (ex: Jan, 01 2022)

Hi @chenboly, unfortunately it seems that Enketo (and probably Collect) send the value of 2022-01-01 even if the appearance is set to “year”. You can add a calculate question to format the date and give only the year:

type name label appearance calculation
date date Date year
calculate year format-date(${date}, ‘%Y’)