Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've noticed that the en_AU locale is defaulting to 24 hour time, it should be 12 hour as this is most commonly used in Australia.

How can this be adjusted?

share|improve this question
1  
Have you not tried the Time & Date Settings? –  Mitch Jun 2 '12 at 6:50

4 Answers 4

The link Rohit provides has the answer, and it's a good one (I used it myself, and I would upvote it if I had enough rep). However, in the spirit of this, and particularly in case Rohit's link goes away, I'm going to write out the answer in full.

Note: this should still be considered Rohit's answer; I'm just transferring it here for posterity.

One way to do what you want would be, as Mitch says, to change your locale to one that uses the time format that you would like. However, that may entail getting other changes that you aren't interested in (Rohit's article has more on this).

More selectively, you can create a custom locale definition file with the format you want, like so:

  1. Change directory to /usr/share/i18n/locales: cd /usr/share/i18n/locales

    This directory contains locale files. The filenames are in the format <ll>_<CC> where ll is a language code (e.g. 'en' for English) and CC is a country code (e.g. US for the U.S. or AU for Australia). The idea is to customize the one you're already using (e.g. probably en_AU for the original poster - I'll use that as the example).

  2. Copy the existing file to a new file (so that you don't lose the original settings):

    sudo cp en_AU en_AU_custom

    You need to use sudo because it's a root-permissions file.

  3. Check the manual for the date command to figure out exactly what format you want for your time display:

    man date

    The manual says:

    %r locale's 12-hour clock time (e.g., 11:11:04 PM)

    which I'll use for this example. To use a different format, just adapt the following instructions accordingly.

  4. Convert your format text into Unicode. You can look up the Unicode equivalent for each character from a site like http://unicode-table.com/en/ , which tells us that % is <U0025> and r is <U0072>.

  5. Edit your new file (the one you created in step 2) with your favourite editor (gedit in the example). It's still a root-permissions file, so you'll still need to use sudo:

    sudo gedit en_AU_custom

  6. Find the section marked LC_TIME and within that, the line starting with t_fmt, which indicates the time format.

  7. Change the format to the unicode equivalent of your preferred time format, being sure to put it in quotes. For this example, the line should look something like this:

    t_fmt "<U0025><U0072>"

    Save the file and exit your text editor.

    You now have a custom locale in the file you created (en_AU_custom in the example above).

  8. Compile your new locale file into a system-readable locale definition with this command (substituting your own filename for the example one, if necessary):

    sudo localedef -f UTF-8 -i en_AU_custom en_AU_custom.UTF-8

    Now the new custom locale is available to the system.

  9. Configure the system to use the new custom locale, by:

    a) editing the file /etc/environment:

    sudo gedit /etc/environment

    b) adding (or modifying) the line that defines which locale to use for time/date (the file you created in step 9):

    LC_TIME="en_AU_custom.UTF-8"

    Save the file and exit your text editor.

  10. Log out and back in to see your new format being applied.

Note: You can use the same process to modify the date/time format (d_t_fmt), date format (d_fmt), am/pm format (am_pm), standard 12 hour notation (t_fmt_ampm), and many other locale settings.

share|improve this answer

how to do it

Restart as mentioned Customize using the above link. Check this solution as done earlier previous issue

share|improve this answer

To check which locale you currently have as your default

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

locale

Changing the default locale is a little different on Ubuntu compared to most Linux distros, these are the steps we needed to go through to get it changed Click Here

share|improve this answer

Got to the symbol at the bar at the top of your screen where the time is displayed and click. Go to 'Time and Date Settings' (or similar). A settings screen will pop up. Choose the 'Clock' tab.

Alternatively go to System Settings, then Choose 'Time and Date' and then the 'Clock' tab.

You can now choose between 12 and 24 hour day.

share|improve this answer
    
Thanks, I realise I can change the display but this does not change the locale settings, which is used by programs such as Thunderbird and Lightning. Is there a way I can change the locale for en_AU to use 12 hour time? –  Alex Jun 3 '12 at 8:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.