Date Display and Formatting

There are three common scenarios for manipulating the display or formatting of Dates in a CommCare application, each with a different method of influencing the system

Changing the format for how dates are displayed in labels or other read-only text

Example

A Label question which displays a date collected elsewhere, like

"The mother's estimated date of delivery is 07-07-2019"

How to Update

You can use the format-date() function when building a date reference to change the formatting, including text or limiting which elements are displayed.

Changing the format of date collection

Example

A date question currently collects date input from the user in "MM-DD-YYYY" format on an Android device, and the user wishes to collected the dates as "DD-MM-YYYY"

How to Update

CommCare collects date data according to the current Android Phone Settings for an individual device. A device purchased in the USA would show a date question as "07-20-1990" while a device purchased in the UK would show a date question as "20-07-1990". Both questions would submit the same data to the server, regardless of how data was collected.

The method for changing this format differs by device manufacturer, but the top 3 common ways to change it are as follows

  1. Android Settings -> General (or similar) -> Date and Time -> Date Format (sometimes you need to uncheck "auto update date/time" first)

  2. Android Settings -> General (or similar) -> Language and Input -> Locale (or "region")

  3. Android Settings -> General (or similar) -> Language and Input -> Language (when no locale or region is listed in this menu) -> Choose the language for device (English, Spanish, French, etc) -> Choose the Region for the device (IE: Guatemala)

In the latter two options, many devices treat the date format as part of the "region" that the phone is currently configured for. On these devices the date format can only be changed by changing the region to match the appropriate one.

Changing the calendar used to a "non-gregorian" calendar

Example

An app wants to collect or display dates according to the Ethiopian calendar

How to Update

Instructions can be found on the Alternate Calendar Formats for CommCare Android page