Custom Date Display in Unity Desktop (and probably some others)

I found that the date and time displayed by Unity Desktop can be customised.

  1. In dconf-editor (or in the terminal) com.indicator.datetime contains many options about date formatting.
  2. Set time-format to custom. This allows custom-time-format to be used for formatting.
  3. Set custom-time-format to a format string.

When I discovered this was possible, it was difficult to find out the exact properties the format string could have. Not all of the placeholders are intuitive: `%w %d/%b/%Y %R`. It's easier to work it out with context from snippets online but I wanted a complete list of the options I had available.

It turns out the C function called strftime is used, which means the syntax can easily be looked up on the internet or in the manpages.

This reminded me of PHP's date format function, but it's different and not just the lack of percent signs.

Comments

Popular posts from this blog

Turn a Web Page into a Desktop Application

The TypeScript "extends" Keyword Doesn't Extend Types