Formatting the menubar clock revisited

Feb 19, '02 11:10:55PM

Contributed by: Anonymous

Here's another followup hint to the Put the date in the menubar article. This one is a bit less invasive (I think).

This hint allows you to change your current displayed time format of the menubar clock to anything you like, i.e. instead of "1:40" you can have "13.02. 13:40" or "13 Feb 13:40". Compared to the modification mentioned above, this really allows full customization of the displayed time/date.

Read the rest of the article for the how-to...

Instructions

  1. Start Terminal.app

  2. cd ~/Library/Preferences (i.e. navigate to your private Preferences directory).

  3. Open the file .GlobalPreferences.plist To do this, you can just enter open .GlobalPreferences.plist at the prompt. If you have the Developer Tools installed, this will open the file in PropertyListEditor.app. I am not sure what happens if you don't have the DeveloperTools, but I would assume the file is opened in TextEdit.app. You can also use Marcel Bresink's PrefEdit to edit the file.

  4. Locate the key with the label NSTimeFormatString. If you have opened the file in TextEdit.app, this will look something like
    	NSTimeFormatString
    %H:%M
    if your current clock format is "13:40"

  5. Edit the format string any way you like. To get the "13.02. 13:40" format, the format string should be "%d.%m. %H:%M" (without the quotes). For a complete list of format string possibilities, see Dates to Strings in Apple's Developer Documentation.

  6. Kill the SystemUIServer process to see the updated time/date format in the menubar (or logout/login). For this, you must have the Menu Bar Clock enabled in System Preferences -> Date & Time -> Menu Bar Clock.
When fiddling around with these settings, I first thought that they were reset when changing the settings of the Menu Bar Clock in System Preferences, but now it seems that the settings are persistent.

NOTE: I do not know what consequences this hack has other than changing the menu bar time format. Since NSTimeFormatString is a global option, it is possible that some other apps use this in a way which is incompatible with a format containing dates and other stuff. Use at you own risk! I have this running a few days now without any problems.

Comments (10)


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