Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By default, the time in AM/PM style is shown, I would like to have the same that ls gives:

2013-01-09 01:12

That is 24 hours and ISO 8601. How can I do this?

I am aware of the following question. Maybe that question was too general to be answered: How do I change to ISO 8601 date format?

I tried the following:

  1. I click on the actual clock-display and I get a calendar. In that calendar I read "Time & Date Settings.." - so I click on it: No effect. No nothing.

  2. I right-click on the clock-display but I get the same calendar like when left-clicking on it.

share|improve this question
up vote 6 down vote accepted

There's no easy way to do it in the GUI. One can either use dconf-editor (which is GUI-ish), and edit two keys in com->canonical->indicator->datetime (time-format to custom, and custom-time-format to the desired strftime directives, in thy case %F %R (or, equivalently, %Y-%m-%d %H:%M)), or do it direct from the terminal with the following two commands (which, just to be clear, change the same keys):

dconf write /com/canonical/indicator/datetime/time-format "'custom'"
dconf write /com/canonical/indicator/datetime/custom-time-format "'%F %R'"

Note that the doubled quotes (for clarity, I'm referring to the nesting of single (') quotes inside double (") ones) are necessary due to dconf's idiosyncracies. Note also that to include seconds, one can replace %R with %T.

(I do not recall which release it was that started including the dconf tools by default, so if they are unavailable, simply install the dconf-tools package and proceed)

Update 2016-05-17: while the above should still work, as a matter of principle it's probably better to be accessing the dconf database via gsettings set than dconf write. Same database, but a tool more intended for end-users (though the corresponding GUI-ish tool remains dconf-editor)

share|improve this answer
I see com.canonical.indicator.datetime in the dconf-editor, but there are no values to set. dconf also had no effect. I tried logging out. Maybe I have to place these lines somewhere? Prior to starting X ? – false Jan 9 '13 at 3:07
Hmm, that's odd. They show up for me, and the dconf commands take effect immediately, too. Which release art using? – Darael Jan 9 '13 at 18:25
It could be 11.10 related. I currently upgrade to 12.04. Will come back. – false Jan 9 '13 at 18:27
Ah. I seem to recall there was some slightly odd interaction between gconf and dconf in Oneiric, although I could be wrong. The methods I suggested work for me in both Precise and Quantal, though I haven't an Oneiric machine to hand with which to test. – Darael Jan 9 '13 at 18:30
Verified to work in 14.04 - I'd love to have "%F, %R" (above) added as an option in the GUI. – Hannu Aug 5 '14 at 10:49

I don't want to install dconf-editor.

I just tried the following in a terminal:

dconf write /com/canonical/indicator/datetime/time-format "'%a %Y%m%d-%H%M%S'"

As you can see, there are no error messages or anything.

I then log out and log back in, but there has been no change to my clock display, which is currently %a %b %e %Y %T.

share|improve this answer
It's fixed now. They key to success is: gsettings set com.canonical.indicator.datetime time-format "'custom'" followed immediately by gsettings set com.canonical.indicator.datetime custom-time-format "'%a %Y%m%d-%H%M%S' – el_gallo_azul Mar 28 '15 at 3:27
since there seems to have been a minor resurgence of interest in the question, I'll point out for posterity that the problem wasn't the use of dconf write (though gsettings set /is/ better); it was setting the custom format in the time-format key rather than putting it in the custom-time-format key and setting the time-format key to "custom". – Darael May 21 at 13:15

Your Answer


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.