Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Formatting the menubar clock revisited Desktop
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.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,580 views]  

Formatting the menubar clock revisited | 10 comments | Create New Account
Click here to return to the 'Formatting the menubar clock revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Or the easy way...
Authored by: Peganthyrus on Feb 20, '02 12:28:41AM

You can do much the same thing in the 'Time' tab of the 'International' preferences pane.

I'm not sure if this is a 10.1.3 addition; I discovered it when I had to go reset my machine from a 24-hour clock display after updating to 10.1.3.



[ Reply to This | # ]
Or the easy way...
Authored by: Peganthyrus on Feb 20, '02 12:33:12AM

Er, sorry, in the 'Date' tab. And you can't go so far as to make the format include date AND time.



[ Reply to This | # ]
Some may not have this key.
Authored by: james_sorenson on Feb 20, '02 02:03:23AM

Some people may find that this key doesn't exist in the global preference file. Just add this under the <dict> key:

<key>NSTimeFormatString</key>
<string>%a, %e %b %H:%M</string>

This gives me the date as follows:
Tue, 19 Feb 23:01

This is a great tip, by the way. I don't have to sacrifice CPU cycles anymore to clock hacks. Cool! PTHClock may be broken ion 10.1.3, but now I don't need it anymore.



[ Reply to This | # ]
Some may not have this key.
Authored by: law on Feb 20, '02 06:47:55AM

In the same idea, how can you set the decimal separator for numbers?
I have a french keyboard and would like to use the dot (.) instead of
the coma (,) but I can't with the systemPreference application and even
when changing the ~/Library/Preferences/.GlobalPreferences.plist file.
The comma is always active...
If anybody knows...



[ Reply to This | # ]
Some may not have this key.
Authored by: james_sorenson on Feb 20, '02 02:29:33PM

If you see my post above, I have included a comma in the field, and it works fine (per the example). Perhaps your delimiters are not set right? You should be using <string> delimiters.



[ Reply to This | # ]
Is this smart???
Authored by: Embro on Feb 20, '02 10:45:52AM

This hack actually resets the time format to include the date. The time format should only format the time. There are separate formatters for the date although the clock app does not look to these to format it's display of the date.
I guess this should be safe since this is only used for displaying the time.



[ Reply to This | # ]
Setting gets reset by changing International Preferences
Authored by: bkuemmer on Feb 20, '02 01:17:28PM

Hi, I am the original author of this tip and I wanted to include a few comments:

- I have had this running for >2 weeks now without any ill effects. I realize
that it *could* lead to problems to include the Date in the Time string...
- As I mentioned in the hint, this setting really gets reset, but not when
changing the Date/Time preferences but when changing the International Prefs

Have fun



[ Reply to This | # ]
This seems to be broken in 10.2 (Jaguar)
Authored by: rsnyder on Aug 26, '02 09:47:03AM

I am no longer able to use this or any of the other MenuBar Clock hacks to add the date to the MenuBar Clock. Does anyone have an idea about how to go about adding Date to time in the MenuBar? I really need the date back in the menu.



[ Reply to This | # ]
This seems to be broken in 10.2 (Jaguar)
Authored by: cabo on Sep 03, '02 05:39:13PM

Works for me.

Did you remember to kill SystemUIServer?



[ Reply to This | # ]
This seems to be broken in 10.2 (Jaguar)
Authored by: mzweng on Sep 30, '02 04:39:27PM

All of my menu bar items seem to be broken now that I've upgraded to Jaguar. I can't get it to show battery status, time, or internet connection on the menu bar at all.

Has anyone else had this problem with Jaguar? (I have a Lombard pbook.)



[ Reply to This | # ]