Time format to 24 hours

AI-generated summary

Changing Time Format to 24 Hours

David_Collantes wants to change the time format on the forum to 24 hours. He discovered that the forum uses Moment.js format string and changed h:mma and h:mm a to HH:mm to achieve this (/t/-/56789/2).

To make this change, users can go to Settings > Customize > Text, search for :mm, and modify the format using the Moment.js format page as a guide, as suggested by AquaL1te.

However, this change may not be fully effective, as some areas, such as chat timestamps, may not be updated. AquaL1te encountered this issue and provided screenshots of the changes made and the remaining inconsistencies.

Ed_Bobkov and Jagster also contributed to the discussion, with Jagster mentioning that changing the country setting does not change the time format to 24 hours in chat.

I would like to change the time format to 24 hours (from 3:00 PM to 15:00). To what do I need to change the current, h:mma and h:mm a? Thanks!

Answering my own question. It seems Discourse uses Moment.js format string. In the case of my request, it is simply a matter of changing h:mma and hmm a to HH:mm. More references on the Moment.js format page.

I hope I did not break things! :slight_smile:

Hi! I didn’t realize how to do it in Discourse. What exactly did you do to change time format to 24 hours?

Go to Settings → Customize → Text

And then search for :mm and then change the format according to what you want with the Moment.js format page as a guide.

However, it doesn’t fully work. In Chat the timestamps went from the AM/PM style to a 24 hour clock, but not everything for some reason. Also did a rebuild and tried with another browser without anything cached.



I modified the following:

Of course changing the locale to a European country (excluding the UK) would do the trick as well. But then the site’s language changes too. To keep custom text and language consistent, I’ve locked it to US English. It’s just the time format I want to change. Maybe the date format later as well.

Does anyone know how to fix those last few inconsistencies in terms of the time format? I want everything in a 24 hour time format, while using US English. My guess is that those outliers don’t use these variables but are hardcoded to that format.

Actually changing country doesn’t change time to 24h on chat. But well, chat isn’t ready yet. But that is because of lack of translations, I reckon.