Is there a way to change the military time format to 12-hour format

Is there a way to change the military time format to 12-hour format

Sali Kaceli -
Number of replies: 11
Is there a way to change the military time format to 12-hour format sitewide for all activities
Ngā whakawākanga toharite: -
In reply to Sali Kaceli

Re: Is there a way to change the military time format to 12-hour format

Helen Foster -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Moodle HQ Pikitia o Particularly helpful Moodlers Pikitia o Plugin developers Pikitia o Testers Pikitia o Translators

Hello Sali,

In Site administration > Appearance > Calendar there's a setting Time display format (calendar_site_timeformat) which allows you to set a 12-hour format for the site.

Ngā whakawākanga toharite: Useful (3)
In reply to Helen Foster

Re: Is there a way to change the military time format to 12-hour format

Sali Kaceli -
Hi Helen, 
Thanks for responding. Unfortunately, it still does not work. I had the Calendar set to 12-hour (am/pm). I also changed it temporarily to default and back to 12-hour with no result. I am obviously setting this as admin. 


Here is what it looks like in the assignment module. 


The preferred language is set to English (United Stated) (en_us) in the profile area and for the site. 

The Calendar Preferences in the profile area is set to 12-hour (am/pm)

Any other suggestions? 



Ngā whakawākanga toharite: -
In reply to Sali Kaceli

Re: Is there a way to change the military time format to 12-hour format

Visvanath Ratnaweera -
Pikitia o Particularly helpful Moodlers Pikitia o Translators
What are the locales the server supports? In Unix boxes the command locale will show the list.
Ngā whakawākanga toharite: -
In reply to Visvanath Ratnaweera

Re: Is there a way to change the military time format to 12-hour format

Sali Kaceli -
Ngā whakawākanga toharite: -
In reply to Sali Kaceli

Re: Is there a way to change the military time format to 12-hour format

Mary Cooch -
Pikitia o Documentation writers Pikitia o Moodle HQ Pikitia o Particularly helpful Moodlers Pikitia o Testers Pikitia o Translators
Are you talking about the display of the times for students - or about when setting deadlines for teachers? WIth 12 hour format set and my language set to en_us I do see the deadlines displayed in the 12 format with am and pm. But when setting up an assignment I always see the 24 hour clock - I am not sure I have ever seen an option to set assignment times with an am and pm option? But hopefully someone else will know better.
Ngā whakawākanga toharite: -
In reply to Mary Cooch

Re: Is there a way to change the military time format to 12-hour format

Sali Kaceli -
I am talking about the setting up of the assignments. Some faculty complain that that it is the 24 hour clock. 
Ngā whakawākanga toharite: -
In reply to Sali Kaceli

Re: Is there a way to change the military time format to 12-hour format

Michael Milette -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Particularly helpful Moodlers Pikitia o Plugin developers Pikitia o Testers Pikitia o Translators

Hi Sali,

As a Moodle site administrator, you can configure the date and time strings in the langconfig language file of the language pack for your language. This can be done by using the built-in language editor in Moodle by navigating to Site administration > Language > Language packs.

A list of the date/time format codes can be found on the following page:

https://www.php.net/manual/en/function.strftime.php

Hope you find this useful.

Best regards,

Michael Milette

Ngā whakawākanga toharite: Useful (2)
In reply to Michael Milette

Re: Is there a way to change the military time format to 12-hour format

Sali Kaceli -
Hi Michael, 

Thanks for the input. Any idea which setting will actually control this. I experimented with the following to no avail. 




I also verified that the course is using the English United States language pack.

Ngā whakawākanga toharite: -
In reply to Sali Kaceli

Re: Is there a way to change the military time format to 12-hour format

Michael Milette -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Particularly helpful Moodlers Pikitia o Plugin developers Pikitia o Testers Pikitia o Translators
Those strings only affect the display of dates and time, not the input.
Ngā whakawākanga toharite: -
In reply to Michael Milette

Re: Is there a way to change the military time format to 12-hour format

Visvanath Ratnaweera -
Pikitia o Particularly helpful Moodlers Pikitia o Translators
Hi Michael

Me too, can't find the solution. This is where I am:


Under the Show strings:



Where to go from there? Of course I entered wild things like %Y %M in to the box, with no effect on time display.

P.S. Making matters worse, https://www.php.net/manual/en/function.strftime.php brings:



May be, you meant to get the date format codes from that page. Moodle has probably moved on.
Ngā whakawākanga toharite: -
In reply to Visvanath Ratnaweera

Re: Is there a way to change the military time format to 12-hour format

koen roggemans -
Pikitia o Core developers Pikitia o Documentation writers Pikitia o Moodle HQ Pikitia o Particularly helpful Moodlers Pikitia o Plugin developers Pikitia o Translators
It's weird that those boxes don't show where the strings are coming from


moodle/course/modedit.php?update=110&return=1&strings=1

It has something to do with some string, probably in langconfig, where a captial H should be replaced by a small h
h    hour, 12-hour format; i.e. "01" to "12"
H    hour, 24-hour format; i.e. "00" to "23"

And may be adding
a    am or pm
A    AM or P

Which language pack are you using?
Ngā whakawākanga toharite: Useful (1)