Change the format of the menubar date display

Nov 17, '01 11:00:31AM

Contributed by: robg

The following was contributed by "Silver", who writes:

"I have been getting annoyed that the date format of the menuling (the date which displays when you click on the menubar clock) is forced on us as American, no matter what the international preference pane promises to store it as. So I fixed it, with a little help from a friend who told me about the chown UNIX command."

This is probably one of the most popular questions I've received here lately. So if you'd like to set the format of the menubar date to your personal choice, read the rest of the article. While not strictly required for this hint, having the Developer Tools installed will make it easier.

Customizing your menubar date format:

  1. Open the Terminal and type:
    cd /System/Library/CoreServices/Menu\ Extras/
    cd Clock.menu/Contents/Resources/English.lproj/
    [NOTE: Shown on two lines for a narrower article display; you can obviously enter this as one long 'cd' command].

  2. Then change the permissions on the Localizable.strongs file, perhaps easiest is chown:
    sudo chown username Localizable.strings
    That is if your short username was 'fred', you'd type:
    sudo chown fred Localizable.strings
    It should then ask for your password, enter it.

    An alternative to chown'ing the file is Pseudo, a $15 shareware package which allows you to run any application as root from your normal user account. Drop PropertyList Editor or the text editor of your choice onto the Pseudo icon, enter your admin password, and the dropped application runs with root privileges, allowing you to directly edit files owned by root in the Finder.

  3. If you don't have the Dev Tools installed, you'll need to navigate to the Localizable.strings file in the Finder first -- open the application bundle by control-clicking it and selecting "Show Package Contents", then open Contents -> Resources -> English.lproj, revealing the Localizable.strings file. Drag and drop this file onto your text editor of choice (launch it if it's not already running). If you have the Dev Tools, skip this step.

  4. Now open Localizable.strings with PropertyList Editor (located in Developer/Applications). If you have a good text editor that should work as well, but I had no luck with BBedit, something to do with Unicode I think. Since you 'chowned' the file (or because you're running your editor as root through Pseudo), you'll have the ability to save your changes. One advantage of PropertyList Editor over a standard editor is that you can use the File -> Open menu to navigate into the application bundles and open the bundled files directly.

  5. Look for the entry for MBC_DATETIME_MENUITEM_FORMAT, which will have a lot of % symbols in its value. The format does obey the standard UNIX date formats. I'm using %A, %d %B %Y which gives me it in the format "Saturday, 17 November 2001", which is my personal preference. Type man strftime in the Terminal for all the choices. You can also include straight text, e.g. "Today is...".

    You may wish to play around with the settings in a terminal window first to determine what you like. To do that, just type date "+%option %option text whatever", where each %option is replaced by one of the formatting pairs from 'strftime' and text whatever is optionally any raw text you'd like to see. When you hit ENTER, you'll see the date displayed in your described format. My personal choice, since I have the menubar clock already displaying the day of the week, is simply "%b %d, %Y" which results in what you see in the image at the top of this article. Note that you need to include the + sign and the quotes in the Terminal, but you do not include either when editing the file!

  6. If you used Pseudo, you can skip this step. Once you've saved your changes, close PropertyListEditor and go back to the terminal. Hit the up arrow until it shows:
    sudo chown username Localizable.strings
    Replace username with the word root so it looks like this:
    sudo chown root Localizable.strings
    and press return. This sets the privileges back to the way you found them. If you're planning on editing it again, you may just want to leave yourself as the owner.

  7. Finally, log out and in again to see your changes. If you dislike logging out and in due to the time it takes, the quickest but perhaps not safest way to see the changes take effect is to kill the SystemUIServer, which is responsible for displaying the menubar. It will quit and restart automatically, reflecting your new settings. To do this, type
    ps ax | grep SystemUIServer
    The first item in the list is the one you want to kill; note the number in the first column and type
    kill some_number
    where some_number is replaced by the number you just noted. You'll see the menubar disappear and reappear, and your changes should have taken effect.
Thanks to Silver for this hint, as I've been wanting to make this change for quite a while on my machine! While there are quite a few steps listed here, this is actually a very easy modification to make, especially whith Pseudo (a worthy $15 product, given how much time it's saved me!) and PropertyList Editor.

Comments (18)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20011117110031152