How to change the date format? [duplicate]

Presently the date is showing as mmm dd hh:mm:ss. Is there any way that I can change it to as per my liking. For example : dd mmm, hh:mm:ss.


Solution 1:

Terminal method

  • First you need to tell the indicator to use a custom format. To do so, run this from a gnome-terminal:

    gsettings set com.canonical.indicator.datetime time-format "'custom'"
    
  • Then you need to tell the indicator which format to use. This has to be done in a format understood by the strftime function. You can look it up here.

    For example, if you want the date/time to look like this: Fri, 20. May 08:25, the format string for it would be %a, %d. %h %H:%M. Now let's set it:

    gsettings set com.canonical.indicator.datetime custom-time-format "'%a, %d. %h  %H:%M'"
    

GUI method

You can also set those keys using a GUI called dconf-editor. It's part of the package dconf-tools, which you'd need to install first by running sudo apt-get install dconf-tools. Then open dconf-editor, navigate to com.canonical.indicator.datetime, and set the two keys.

screenshot of <code>dconf-editor</code> at <code>com.canonical.indicator.datetime</code> schema