22

I want to change the date/time format on the top panel to a format close to RFC 3339 / ISO 8601, like one of these:

%F %T → 2013-06-24 16:13:00

%F %a %T → 2013-06-24 Mon 16:13:00

%A %F %T → Monday 2013-06-24 16:13:00

I know Unity has a preference somewhere hidden away in dconf, this is how I did it in Unity, but I can't find such a preference for Gnome 3 shell. Preferably, I'd also like to set one of these as my system-wide date/time locale preference.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • 1
  • 3
    @Radu: Unity shell is not Gnome shell. No, it's not a duplicate of that question. – James Haigh Jun 24 '13 at 15:35
  • Unfortunately, [tag:gnome-shell] is a synonym of [tag:gnome], when in fact it is only a part of Gnome 3 that is replaced by Unity shell in main Ubuntu. – James Haigh Jun 24 '13 at 15:39
  • @edwin: Either which way? I don't even have those 2 keys in my dconf. Maybe you should test it yourself, and if you succeed, post an answer back here. Until then, this question is not a duplicate of that one. As I mentioned in the question, I know it's possible in Unity, I've done it before, using those 2 keys, but this is Gnome shell. Can we move on now? – James Haigh Jun 24 '13 at 16:12
  • 1
    I have been looking here, here, and here. Put so far (at least according to the last 'here') it looks like the API has been modified so the format is inside the C/C++ code. I mean I cannot find anything in the JavaScript API about the WallClock class (which you could use to change the file /usr/share/gnome-shell/js/ui/dateMenu.js). – edwin Jun 24 '13 at 17:19
  • @edwin: Thanks, that's useful. Maybe I might make an extension one day. :-) – James Haigh Jun 24 '13 at 17:26
  • You can browse the code here in the file gnome-wall-clock.c and its header, the API doesn't give you public methods to deal with a custom clock format. – edwin Jun 24 '13 at 17:37
  • You can use localisation without the need to install any extensions, as explained: https://askubuntu.com/questions/1096203/how-to-display-custom-formatted-clock-in-top-bar-on-multiple-displays-in-ubuntu – Broadsworde Nov 15 '19 at 10:30

6 Answers6

16

Open a terminal and set

gsettings set org.gnome.desktop.interface clock-show-date true

YMMW - this did work for me on Fedora 19.

Martin
  • 217
11

I was ultimately able to achieve my exactly desired format using a GNOME extension made by Daniel Khodabakhsh. Thank you Daniel!

I found that here: https://github.com/Daniel-Khodabakhsh/datetime-format

Screenshot: enter image description here

Format: %A | %m-%d-%G | %I:%M %p

Lonnie Best
  • 2,194
  • 2
  • 35
  • 46
  • Where do you write that format? I see a lot of files and directories in the directory installed by that program, but I can't make much sense of it. – Andyc Jul 18 '21 at 11:11
  • You write it right were it is shown in the screenshot, using Tweaks (Notice all 3 windows and their stack-order, in the screenshot). @Andyc – Lonnie Best Jul 19 '21 at 16:03
6

In addition to what Martin says, the following worked for me on Ubuntu 14.04, where dconf-editor didn't:

gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-show-seconds true
seddy
  • 193
  • 4
    As with Martin's answer, the question is asking how to change the format of the date displayed (by the clock and in other places), not how to display the date next to the clock. – Harry Cutts Dec 02 '17 at 01:12
  • Fair point, additionally I should probably have left this as a comment on Martin's response – seddy Jan 22 '18 at 12:09
4

You can try one of these three extensions:

  • Full Clock

    enter image description here Replaces the default clock with a complete one showing time, date and week day

  • Full Clock 2

    enter image description here Replaces the default clock with a one showing date, week, day of week and time.

  • Format Clock (development discontinued, but apparently working fine in 3.16)

    enter image description here Change top panel clock format.

    It says the develpmont has been discontinued, but I tested it, manually editing metadata.json to include 3.18, and it works:

    enter image description here

muru
  • 197,895
  • 55
  • 485
  • 740
  • I am unable to install any of those because they do not seem to support 3.18 and it doesn't even seem to download them. –  Dec 27 '15 at 20:24
  • @ParanoidPanda Format Clock is on Github (see README for instructions), and you can try http://bernaerts.dyndns.org/linux/76-gnome/283-gnome-shell-install-extension-command-line-script for the others. – muru Dec 27 '15 at 20:30
  • 2
    And there is no way of changing any settings in dconf-editoror something to do this rather than installing something? –  Dec 27 '15 at 20:37
  • @ParanoidPanda nope. The only settings I can find are for just showing the date there. – muru Dec 27 '15 at 20:37
2

Partial answer:

Although it doesn't look like the panel clock is easy to format, the calendar menu opened by clicking on it is very easy. Here's a quick hack:

$ sudo vim /usr/share/gnome-shell/js/ui/dateMenu.js

(vim or any other text editor.)

Search for ‘B %d, %Y’, and replace with ‘F’. Save. Press Alt+F2, r, Enter, to restart the shell.

Searching the parent directory reveals a few others that might be worth experimenting with:

$ rgrep -I '%B' /usr/share/gnome-shell/js/ui/

but unfortunately, searching for the abbreviated month name in the panel clock returns nothing here:

$ rgrep -I '%b' /usr/share/gnome-shell/

Any changes to these file will probably be overwritten by updates to Gnome, and you may want to keep the originals of files you edit (sudo mv [name].js [name].js.orig).

0

On Ubuntu 19.10:

gsettings set org.gnome.desktop.interface clock-show-weekday true
gsettings set org.gnome.desktop.interface clock-show-seconds true

etc.

Or, run

dconf-editor

and go to org.gnome.desktop.interface. You will find clock-show-weekday, clock-show-seconds, clock-show-date and others.

Eliah Kagan
  • 117,780
G. S.
  • 17