How can I change the default date format?

I have formatted the date. But it increases another column. Is it possible to replace the default date format to my custom format (d/m/y)?

date%20format
date%20format-kobo

Nope. The format used to submit results to the server of type date is prescribed and fixed by the XForms specification. However you can convert to/from pretty much any custom format you desire using the format-date() function.

For example, to get something like “09/10/19” you can use:

format-date(${mydate}, '%d/%m/%y')

If you use this in a calculation, your calculation result will contain your date in your desired format when submitted to your server.

Thanks a lot, @Xiphware. Do you show me how should I write? I have tried, but not working.

date-error

since you are reformating ${mydate} to a custom format, you need to put it in a new result, of type text; ie

type=text, name=mynewdate, calculation=format-date(${mydate}, '%d/%m/%y')

(${mydate} is type date, so you cannot reformat it in situ)

2 Likes

Hello,
just as side-note: You will loose a lot of functionality (like adaptable calendar widget, date calculations, date type in export, …) with the conversion to a text field.
In general, it may be preferable to keep with the standard options of KoBo (the tool used).
Kind regards
Wolfgang

2 Likes