Date Format for date question and import needs to be in specific format DD-MM-YYYY

I want my Date of birth date question to display in DD-MM-YYYY which is different than the default. I want all new cases and any existing imported cases to display the Date of Birth in the same format. How can the expression be written to allow a new date in this format and any imported dates to be in this format. I hope this makes sense.

To import you need yyyy-mm-dd format. However, for display on your tab/web, you may use the following link

https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-format-date
to display in your desired format

Maira,

Amit's function will let you display the date in different formats within text.

If you want to collect date information within a form in a different format, you'll need to update the Android System Locale within android's system settings. CommCare respects whatever date format the system deems appropriate for the current locale.

-Clayton

Hi Clayton,
I am so confused. I received several errors in trying to format this date. Here is a list of my errors as best as I could explain.

  1. I used this - format-date(date(/data/my_date), "%e/%n/%y") and received an error on the web app that stated "my-date" was not a question id. I changed my-date to the question ID on my form. But another error fired that my question could not reference itself.
  2. I added the statement above to the display condition field in the form question. Is that the correct place to enter such statement.
  3. I am building in the United States in HQ - deploy version in the USA to test/unit build but the actual deployment will be done in the Dominican Republic (DR). Are you saying that I can't display the date format differently because my locale is USA and not DR?
    Thanks for your help I truly appreciate it.

Hi Maira,

I updated the documentation on this page:

https://confluence.dimagi.com/display/commcarepublic/Date+Display+and+Formatting

to reflect these different options. Can you let me know whether that clarifies your question?

-Clayton