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")

1 Like

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