Hello!
how can I dynamically format datetime values in a jsp (legacy UI) in the format defined by the current locale ?
For example with locale set to “en” the timepicker.js outputs “03/30/2016 12:18 PM” and so does <spring:bind path="effectiveStartDate">${status.value}</spring:bind>
. And the format changes according to the configured locale, so thats what I want!
In my case I am showing a read-only list where I cannot use <spring:bind path>
and timepicker.js.
I therefore tried <openmrs:formatDate date="${radiologyOrder.effectiveStartDate}" type="short" />
but the available type’s lead to
- short = 03/30/2016
- medium = Mar 30, 2016
- long = March 30, 2016 8:27:00 AM UTC
which is different from what
<spring:bind path>
and timepicker.js do.
Using
<openmrs:formatDate date="${radiologyOrder.effectiveStartDate}" format="MM/dd/yyyy hh:mm a" />
I get what I want in the case of locale “en”, but I dont want to hard code the format. The format should be dynamically set from the locale settings.