Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

Add the date to the menubar in 10.2 Desktop
Over on this thread in the macosxhints' forums, someone asked how to change the Menubar clock display to include the date. There was a hint for this under Mac OS 10.1, but the method didn't work under Jaguar. Thanks to a great discovery by SpongeBob, it is now possible.

To customize your Menubar clock in Jaguar, you must edit the file:
/Users/username/Library/Preferences/.GlobalPreferences.plist
Replace username with your user name. Specifically, you must edit the key "NSTimeFormatString" in the referenced file. You can add, move, or remove the various components of the format. The default is %1I:%M:%S; to find other "%" codes to use, type
man strftime
in a Terminal window. For example, I have my NSTimeFormatString set up as %b %e - %1I:%M:%S, which shows up as "Sep 4 - 4:55". Once you have saved the changes to .GlobalPreferences.plist (I used pico to make the changes), go into System Preferences -> Date and Time -> Menu Bar Clock and deactivate and then reactivate the clock. You should see the changes to the clock.

Note: Depending on which options ("Display time with seconds," "Show day of the week," etc.) for the Menu Bar Clock you have set in System Preferences, you may create redundancies. To be on the safe side, disable all these prefs and then use the above method to add exactly what you want.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[17,007 views]  

Add the date to the menubar in 10.2 | 25 comments | Create New Account
Click here to return to the 'Add the date to the menubar in 10.2' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Use BBEdit
Authored by: klmay65 on Sat, Sep 7 2002 at 2:04PM PDT
I used BBEdit's "Open Hidden..." command (in the File menu), to open the plist file, then I modified the "NSTimeFormatString" to "%x @ %1I:%M:%S" to change the menubar clock to "Sat Sep 07 2002 @ 11:03:42 AM".

Thanks for the tip to get into this.


[ Reply to This | # ]
Cool
Authored by: Titanium Man on Sun, Sep 8 2002 at 12:41PM PDT
I'll have to try this. I currently use PTHClock which is great.

[ Reply to This | # ]
Bloop.
Authored by: whee on Sun, Sep 8 2002 at 2:00PM PDT
I've always used "%a:%d %time%p" for the menu time (although mine is modified by editing Localizable.strings in Clock.menu). This would expand to something like "Sun:08 1:58 PM".

I find this works rather well, mainly because 1) I know the month, 2) I know the year, and 3) weekday/time is all that changes frequently.

[ Reply to This | # ]
Bloop.
Authored by: Mike3143 on Sun, Sep 15 2002 at 9:59AM PDT
What directory is the Clock.menu located?

[ Reply to This | # ]
Works in 10.1.5, too
Authored by: davetron5000 on Sun, Sep 8 2002 at 4:06PM PDT
For anyone boycotting the Jaguar price gouge, this tip works in 10.1.5 as well (although the example date string puts the day of the week on as well. No biggie).

Dave


[ Reply to This | # ]
Property List Editor
Authored by: mhagers on Mon, Sep 9 2002 at 5:04AM PDT
If you've installed the dev tools, you can change this setting using the Property List Editor. It's found in Developer/Applications.
Or if you used Tinkertool to display invisible and system files, double-click the file mentioned in the tip and it will open in Property List Editor automatically.

[ Reply to This | # ]
This damages iPhoto a bit
Authored by: cabo on Fri, Sep 13 2002 at 8:12AM PDT
When you change the NSTimeFormatString, iPhoto displays the creation times of photos in the same form.
Unfortunately, iPhoto also displays the date on its own, and the little text area is too small to display the date twice and then the time.
I suspect there are other apps that take a hit from this hack.

I'll have to try hacking Clock.menu.


[ Reply to This | # ]
String Changes Watson Date Appearance in T.V. Listings Window
Authored by: XUSER on Thu, Sep 11 2003 at 7:01AM PDT
I modified my time string to be: <%A / %b. %e / %1I:%M:%S%p> It works very well, with the exception that it causes some oddities to appear in the Watson T.V. Listings window, in the way that date is shown. These oddities appear to be purely cosmetic, however. They do not appear to cause any anomalous function. Probably affects iPhoto, too. I am not using iPhoto.


[ Reply to This | # ]
This damages iPhoto a bit
Authored by: William McCallum on Sun, Sep 21 2003 at 5:05PM PDT
This problem is worse than cosmetic. When you try to edit a date in iPhoto it thinks you are still using the old format and gets thoroughly confused, so you end up with really strange dates.

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: comprock on Sat, Aug 23 2003 at 2:02AM PDT
Thank you for this. I've been getting tired of wondering around for the date with the mouse.

My menu clock from .global.Prerferences.plist

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

Result: Sat, Aug 23 01:02

Also, I could get the new date format showing up by simply selecting view as icon and then reverting back to view as text.

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: benixau on Sat, Aug 23 2003 at 6:18PM PDT
I actually am rather cheap. I let MacOS do most of the work. My NStimeFormatString is this: %d/%m, %1I:%M:%S I then let MacOS have it's prefs at "Show AM/PM" + "Show Day Of Week"

My Menu bar now looks like this: Sun 24/08, 8:15 AM
Very nice indeed.

I also flash the time seperator cause thats how my dad had it on his System 7 LC630. I like them flashing - lets me know when MacOS crashes. I develop - it crashes a lil more often than most (4-5 times a year maybe :D)

[ Reply to This | # ]
Safely add the date to the menubar in 10.2
Authored by: snowyowl on Tue, Sep 23 2003 at 2:16PM PDT
As several people noted, changing the global time or date format affects applications other than the menu bar clock. Editing the clock's own display format instead is less apt to cause problems elsewhere.

In OS 10.2.6 (at least; probably other versions too), use the Terminal:

cd '/System/Library/CoreServices/Menu Extras/Clock.menu/Contents/Resources'

Go to the directory for your localization; for English, that's

cd English.lproj

The Localizable.strings file is in a format that's not very emacs-friendly, so I had to open it in Project Builder after backing it up:

sudo cp Localizable.strings Localizable_bak.strings
open Localizable.strings

Edit the MBC_CLOCK_FORMAT_STRING field to your favorite value, using display codes similar to those for the C strftime() function. For instance, I like "%a %d %b %time%p", which gives "Tue 23 Sep 11:11:07 AM" (or something similar, depending on your clock preferences). The codes are documented at http://developer.apple.com/documentation/Cocoa/Conceptual/DatesAndTimes/Tasks/DatesToStrings.html

I don't know how to get Project Builder to overwrite a locked file, even opening it in a sudo, so I saved the Localizable.strings to the Desktop, then copied it back to where it belongs. Assuming you're still in the English.lproj directory,

sudo mv ~/Desktop/Localizable.strings .

Log out and log back in to update the clock display.

snowyowl

[ Reply to This | # ]

HELP! (was: Safely add the date to the menubar in 10.2)
Authored by: Mr. Bappo on Fri, Oct 10 2003 at 12:09AM PDT
I managed to screw this up (which, if you knew me, is not so unusual, sigh...). I opened the menu clock prefs file using BBEdit, made the change to display the date, saved the file to the desktop and copied it back to the proper location using the Terminal. Logged out and back in, and now my menu clock text is in Korean.

I examined the file in the Terminal and realized that the ownership was now to my user, not root, so I used the chown command to reset the permissions to the root user and the group to wheel (which seems to be the default for all system files). Still no luck.

I then used Tinker Tool to show hidden files in the Finder, and in doing so realized that the file was now typed to BBEdit, so I removed the BBEdit filetype and creator codes from the file. Still no luck.

Any ideas? I did not make a backup of the file (yeah, I know, lesson learned trust me!) and I'm guessing that I'm missing something very simple here...

Thanks in advance for any assistance!
Mr. Bappo

[ Reply to This | # ]
HELP! (was: Safely add the date to the menubar in 10.2)
Authored by: snowyowl on Sun, Oct 12 2003 at 9:59PM PDT
Nothing springs to mind. What OS version are you running, and what did you change the MBC_CLOCK_FORMAT_STRING to?

snowyowl

[ Reply to This | # ]
Safely add the date to the menubar in 10.2
Authored by: silentway on Tue, Nov 4 2003 at 3:30PM PST
I tried this and get hung up at the end- when I move the new Localizable.strings from the desktop to the English.lproj directory, it doesn't appear to overwrite the old version. (Even after logging out/in.) If I do a ls -al on the English.lproj directory, the mod date still shows 7/2002. Here are the results of the mv:

usage: mv [-fi] source target
mv [-fi] source ... directory

That means it overwrites the old version, right? hmmm... any thoughts?

---
Tony Brooke
OS X 10.2.5, G4/867 PowerBook, 768mb
http://www.silentway.com
http://www.tastycast.com

[ Reply to This | # ]
Safely add the date to the menubar in 10.2
Authored by: jfw on Wed, Dec 17 2003 at 12:49AM PST
No, that means you had a syntax error in your mv command.
It did not do anything and is reporting what the correct usage format should be.

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: BobHarris on Sat, Oct 25 2003 at 10:42PM PDT
Anyone know how to make this work in Mac OS X 10.3 Panther?

My .GlobalPreferences.plist has my original modifications, but my menubar clock does not display them.

This leads me to beleive that Panther is using some other way to format the menubar clock string.

Does anyone know what that is. I found this little trick to be very useful.

Bob Harris

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: benfsmith on Mon, Oct 27 2003 at 10:54AM PST
same problem here. Any suggestions appreciated.

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: mathewlu on Tue, Oct 28 2003 at 10:08PM PST
Panther Broken!

I hope somebody figures out another way to do this.

[ Reply to This | # ]
Panther broken!
Authored by: bluehenbear on Sun, Nov 2 2003 at 3:38PM PST
This hint does not appear to work in Panther 10.3.

I edited the .GlobalPreferences.plist file as indicated, disabled and enabled the "Show Date and Time" check box on the "Date & Time" pref pane, but the date does not show up.

[ Reply to This | # ]
Panther broken!
Authored by: snowyowl on Tue, Nov 4 2003 at 12:26PM PST
I don't have 10.3 yet, but did you try editing the display string in Clock.menu, as described below?

snowyowl

[ Reply to This | # ]
Panther broken!
Authored by: bluehenbear on Tue, Nov 4 2003 at 11:16PM PST
Yes, I did try this as well, but still doesn't work in Panther.

Here's what I changed it to:

"MBC_CLOCK_FORMAT_STRING" = "%a %b %e %time";

but still only get the day-of-week and time in menu bar clock

(Sorry for the double post, I replied to wrong comment)

[ Reply to This | # ]
Panther broken!
Authored by: joesao on Wed, Nov 5 2003 at 12:41AM PST
In Panther, the .GlobalPreferences.plist doesn't have the date format string key anymore.

It seems that this is kept in the com.apple.MenuBarClock.plist -- however, I tweaked that file and couldn't get it to work. Even a simple change of TimeFormatString from %1I:%M:%S %p to %Y:%1I:%M:%S %p doesn't work.

I hope somebody can hack this soon.

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: bluehenbear on Tue, Nov 4 2003 at 11:13PM PST
Yes, I did try this as well, but still doesn't work in Panther.

Here's what I changed it to:

"MBC_CLOCK_FORMAT_STRING" = "%a %b %e %time";

but still only get the day-of-week and time in menu bar clock

[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: msephton on Mon, Apr 12 2004 at 8:37AM PDT
I'd also love a Panther work around for this.

[ Reply to This | # ]