Date Format

Hi,

While creating the form with the help of “date” field, the date format is “YYYY-MM-DD” by default. so, can we change the format into “DD-MM-YYYY”.
Could you please help me to get the format “DD-MM-YYYY”?

Thanks in Advance!
Keerthi

Take a look at the format-date() XPath function.

For your specific usecase try this:

calculation = format-date(${my_date}, "%d-%m-%Y")

2 Likes

Hi there,
I keep trying this in my excel worksheet and cannot get it to function in the survey.
Please help?
Hayley

Hi @hayleydodd,

Welcome to the community! Would you mind sharing your xlsform so that we could have a look at it on why it’s still not working.

Have a great day!

Hi @hayleydodd
Also ensure that you are only using this part of the

Stephane

1 Like

Hi there,

Thanks so much - please see attached.

Hayley

Screening Questionnaire XLSForm_HD7Jan20.xls (29 KB)

1 Like

Hi @hayleydodd,

Simply polishing your xlsform to what @Xiphware and @stephanealoo has already mentioned earlier so that it’s easy for you to track the errors (those highlighted in yellow) you have made outlined in the image below:

In the survey tab of your xlsform:

In the choices tab of your xlsform:

Data Entry Form as Seen in Enketo (aka web form):
image

Reference xlsform:
Screening Questionnaire XLSForm_HD7Jan20.xls (26.5 KB)

Have a great day!

1 Like

Hi Team,

Greetings!
Thanks for Response, We are able to achieve the date format in “DDMMYYYY”.

But is their any possibility to write the calculation condition “format-date(${baby_DOB}, ‘%d/%m/%Y’)” for same date filed. As shown in the below image.

Expected Output:

We are unable to achieve that, could you please help on this. Thanks!

Hello,
No, (as far as I know), as this will create a format error for the standard date type.

Hint: In Collect the date format show in a form adapts to the language configuration, e.g. for French

.

Maybe someone of the core team can say if there is any similar option for Enketo device configuration (like system date format)? @Kal_Lam

Dear @Kal_Lam

Can we change to other date format such as: Oct 04, 2022 or 04-Oct-2022? Please help.

Welcome back to the community, @sreangphaly! Maybe the easiest way to do that would be in the post-processing phase. It’s quite easily done with Excel.

Dear @Kal_Lam, thanks for your welcome. My question means to change format by using formula in KoBo xls form. I tries to use date as condition to select year as semester (I don’t want to list down all 6 years time of assessment in list to select) of my assessment but it work only in web but not work in KoBo app because KoBo app show the date format as eg “Oct 06, 2022”, while I have tried to search in community and found only formula "format-date(${date},‘%Y-%m-%d’) which is not the same format in KoBo. That’s why my formula is not work in KoBo.

@sreangphaly. could you share a screenshot of the date format from both the Collect app and the Enketo you are trying to describe? Maybe the community should be able to understand it pictorially then.