Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 4.33 / 5
  You rated: 5 / 5 (3 votes cast)
 
[21,397 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 whoever posted them. This site is not responsible for what they say.
Use BBEdit
Authored by: klmay65 on Sep 07, '02 02:04:44PM

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 Sep 08, '02 12:41:11PM

I'll have to try this. I currently use PTHClock which is great.



[ Reply to This | # ]
Bloop.
Authored by: whee on Sep 08, '02 02:00:06PM

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 Sep 15, '02 09:59:53AM

What directory is the Clock.menu located?



[ Reply to This | # ]
Works in 10.1.5, too
Authored by: davetron5000 on Sep 08, '02 04:06:07PM

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 Sep 09, '02 05:04:54AM

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 Sep 13, '02 08:12:17AM

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 Sep 11, '03 07:01:04AM

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 Sep 21, '03 05:05:50PM

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 Aug 23, '03 02:02:50AM

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 Aug 23, '03 06:18:35PM
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 Sep 23, '03 02:16:46PM
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 Oct 10, '03 12:09:20AM

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 Oct 12, '03 09:59:39PM

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 Nov 04, '03 03:30:52PM

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 Dec 17, '03 12:49:43AM

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 Oct 25, '03 10:42:19PM

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 Oct 27, '03 10:54:28AM

same problem here. Any suggestions appreciated.



[ Reply to This | # ]
Add the date to the menubar in 10.2
Authored by: mathewlu on Oct 28, '03 10:08:07PM

Panther Broken!

I hope somebody figures out another way to do this.



[ Reply to This | # ]
Panther broken!
Authored by: bluehenbear on Nov 02, '03 03:38:22PM

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 Nov 04, '03 12:26:49PM

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 Nov 04, '03 11:16:34PM

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 Nov 05, '03 12:41:49AM

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 Nov 04, '03 11:13:58PM

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 Apr 12, '04 08:37:49AM

I'd also love a Panther work around for this.



[ Reply to This | # ]