0 Replies Latest reply: Nov 8, 2008 6:57 AM by Michael Conniff
Michael Conniff Level 7 Level 7
Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.

Put the Date in the Menu Bar for Mac OS X 10.3

To put the date, as well as the time, into the Menu Bar in 10.3 is not the same as in 10.2 and earlier (see the corresponding FAQ for 10.2), and to complicate things further, the format strings used are different. I have run this on an English language version for several years with no apparent problems – others have reported that it works on systems localised to French and German.

This change can only be accomplished using the Terminal application, which you will find in /Applications/Utilities. If you are not comfortable using commands at a command line prompt, do not attempt this change.

Note You should not attempt to type these commands directly, rather use copy and paste to get the commands into a Textedit document (set to Plain Text from the Format menu). Be warned that sometimes copying and pasting from a browser window puts an additional space at the end of a line, so if a command wraps, check that the line has exactly one space where it wraps, and no end-of-line character there. Extra space happens to matter in the "defaults" command because the line wrap tends to occur inside a quoted format string.

The commands below will give, for example, "Thu 2 Dec, 02:15 pm" in the menu bar. If you're in the USA, you might prefer to have the month precede the day, so you would reverse the order of the 'd' and 'MMM' format specifiers. Note that if you put the day-of-week format specifier (EEE) in the string, you will get two days listed if the "Show the day of the week" box is checked in System Preferences > Date & Time > Clock, so un-check that.

Edit the format to your choice (see below for the different codes), then when you are happy with it, paste it into Terminal, and press the return key. If it works, Unix won't tell you – it is very concise. So, one command at a time, and press return after each.

First, take a backup of the existing preference file. Only do this the first time you attempt this – the idea is to keep a copy of the original Apple file. The first command gets to the right directory:

cd ~/Library/Preferences

Then copy the existing file, preserving modification dates, etc:

cp -p .GlobalPreferences.plist .GlobalPreferences.plist.orig

Now set our desired format ALL ONE LINE, please:

defaults write -g AppleICUTimeFormatStrings -dict-add 2 "d MMM, hh':'mm':'ss' 'a"

It is important now to immediately reset the Menu Bar, or our changes will be undone!

killall SystemUIServer

This will cause your Right Hand Menu Bar to disappear and then re-appear in the new format. (This often resets the "Show the day of the week" and "Show seconds" options in "Date & Time", so you may wish to change these). If all looks OK, it is a good idea to save a copy (but you need to have executed the 'cd' command above first):

cp .GlobalPreferences.plist .GlobalPreferences.plist.bak

My experience with this indicates that your changes can be lost if you go into System Preferences > International > Formats and click either of the "Customise" buttons for Date and Time (even if you then "Cancel"). If this happens, it is easy to restore things from this copy:

cd ~/Library/Preferences
cp .GlobalPreferences.plist.bak .GlobalPreferences.plist
killall SystemUIServer

To go back to the Apple default settings, use the same command sequence but replace ".bak" by ".orig".

Formats for Date/Time

 Symbol Meaning Presentation Example
------ ------- ------------ -------
G era designator (Text) AD
y year (Number) 1996
M month in year (Text & Number) July & 07
d day in month (Number) 10
h hour in am/pm (1~12) (Number) 12
H hour in day (0~23) (Number) 0
m minute in hour (Number) 30
s second in minute (Number) 55
S millisecond (Number) 978
E day of week (Text) Tuesday
e day of week/local (1~7) (Number) 2
D day of year (Number) 189
F day of week in month (Number) 2 (2nd Wed in July)
w week in year (Number) 27
W week in month (Number) 2
a am/pm marker (Text) PM
k hour in day (1~24) (Number) 24
K hour in am/pm (0~11) (Number) 0
z time zone (Text) Pacific Standard Time
' escape for text
'' single quote '

The count of pattern letters determines the format, as follows:

(Text): 4 or more, use full form, (Number): the minimum number of digits. Shorter numbers are zero-padded to this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits. (e.g., if "yyyy" produces "1997", "yy" produces "97".)

(Text & Number): 3 or over, use text, otherwise use number. (e.g., "M" produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM" produces "January".)

This table, with additional notes, can be found at the International Components for Unicode (ICU) User Guide website. Reprinted by permission from International Business Machines Corporation copyright (2000 - 2004).

This is the 2nd version of this tip. It was submitted on Aug 4, 2008 by Michael Conniff.

Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.