You can change the format of your date via the terminal by doing the following,
You need to customise your current locale (en_IE in my case). To do this, change directory to /usr/share/i18n/locales. Here you will find many locales for many regions. Choose the locale you wish to customise and copy it by executing:
Code:
sudo cp en_IE custom
Next chose the date or time format string you would like. In my case it will be “%d.%m.%Y”. You can check and modify this string using the date command, as in:
If this returns the date in the format you would like, then you know you have the right format string. You can find all format codes if you use “man date”.
The date format string, is specified in the locale file using a Unicode notation. Open your custom locale using your favourite text editor:
The date format is specified on the line beginning “d_fmt”, and looks like:
d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025> <U0079>"
You will now have to convert your date format string to Unicode. You can do this, by looking up the Unicode equivalent for each character on http://asciitable.com/. In this way “%” becomes “<U0025>”, “d” becomes “<U0064>”, “.” becomes “<U002E>”, and so on. Replace the d_fmt line with your new format string:
d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025> <U0059>" The same process can be used to modify the datetime format (d_t_fmt), date format (d_fmt), time format (t_fmt), am and pm format (am_pm), and standard 12 hour notation (t_fmt_ampm), as well as other locale settings.
Save and exit your text editor. You now have a custom locale in the file “custom”. In order for the system to use it, you need to compile it into a system readable locale definition. This can be done using the locale compiler by executing:
Code:
sudo localedef -f UTF-8 -i custom custom.UTF-8
Now the new custom locale is available to the system, you need to configure the system to use it. Do this by editing the file /etc/environment (sudo gedit /etc/environment) and adding (or modifying) the line:LC_TIME="custom.UTF-8"
All that remains is to log out and log in again, or restart any system services, to see the new format being applied.
Hope this solves your problem.
Bookmarks