Changing the date display format in Ubuntu 10.04 LTS

I am basing the majority of this off of the info I found at:

Basically I wanted to change how GTK based apps display the date. I wanted the format to be YYYY-MM-DD. In KDE this can be changed via the control panel-like interface. Gnome does not seem to have this option.

Gnome simply uses the same data that you can find by running the locale command. What we will end up doing is cloning our current locale, editing it, then installing our custom locale.

The locales are located at /usr/share/i18n/locales. In my case my locale is en-CA so I am going to use that as a base for my custom locale, thus preserving currency and language settings.

  1. sudo cp /usr/share/i18n/locales/en-CA /usr/share/i18n/locales/custom

I then edit that file looking for a line that starts with , the complete line looks like this:

  1. d_fmt  "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"

While this may look unintelligible it is really just a Unicode representation of the "date" command's command line interface. We can look up the Unicode at

I changed the line in my file to look like this:

  1. d_fmt  "<U0025><U0059><U002D><U0025><U006D><U002D><U0025><U0064>"

This results in a date format similar to 2010-12-14.

Once we have saved our changes, we now have to compile this into a system usable locale definition. The command to do this is pretty straight forward:

  1. sudo localedef -f UTF-8 -i custom custom.UTF-8

We tell the system to use our custom locale in the /etc/environment config file. We point the LC_NAME variable to be that of our custom locale. In this example that line looks like this:


All we need to do is log out and back in again to start using this locale. If you have a server (such as a mail server) you may need to restart those services. For a desktop machine all that should be required is to log out and back in again.