How to change datalist datetime input format from 24 hour military to 12 hour AM/PM

cancel
Showing results for 
Search instead for 
Did you mean: 
Scorpios
Customer

How to change datalist datetime input format from 24 hour military to 12 hour AM/PM

Can someone tell me what would be involved to change a data list input formatting of a date/time from 24 hour military format to a 12 hour AM/PM format when creating and editing a datalist date/time item.

24HourDateTimeInput.PNG

Thank You.

 

 

3 Replies
abhinavmishra14
Advanced

Re: How to change datalist datetime input format from 24 hour military to 12 hour AM/PM

The date/time formats are configured at form level irrespective of data list form or any other form you configure.

You can do it by extending the form properties. You can find OOTB form.get.properties under "<alfresco_installation_home>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form\form.get.properties" or check the source code here for taking the reference of all the properties.

You can try changing the properties related to time format and see if it works for you. I have not tried it though. However, i had extended date format specific properties to change the date format as i can recall and it worked.

These are the properties you would be looking to try and change:

 

## Format used for time entry in datetime picker, 'entry' format is used by date parsing code,
## 'display' format is shown to the user under time entry field
form.control.date-picker.entry.time.format=HH:mm
form.control.date-picker.display.time.format=HH:MM (24 Hour)

## Format used for date and time when form is in 'view' mode
form.control.date-picker.view.date.format=EEE dd MMM yyyy
form.control.date-picker.view.time.format=EEE dd MMM yyyy HH:mm:ss z

Here hh for 12 hour format and HH for 24 hour format. 

 

Note that, this extension will change the time format across share, i.e. any property with dateTime data type on forms will display time format configured above. It is not specific to only data list.

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
Scorpios
Customer

Re: How to change datalist datetime input format from 24 hour military to 12 hour AM/PM

Thank you for your suggestion. While that may change the internal formatting, the input screens are still prompting the user to use military time and there is not way to select AM or PM when inputting the time.

 

24HourDateTimeInput2.PNG

abhinavmishra14
Advanced

Re: How to change datalist datetime input format from 24 hour military to 12 hour AM/PM

The highlighted part is a label in the properties file.

May be a hint, if you are looking for something like user should select AM/PM from the from, then you would have to develop a custom form template to show AM/PM marker which user can select and while saving the form you will have to handle it in repo layer form.post webscript; 

You need to also consider making customization to the view form to show am/pm marker.

~Abhinav
(ACSCE, AWS SAA, Azure Admin)