Setting the Date and Time Format for the macOS Menu Bar Clock Using Terminal

S

In the Clock tab of the Date & Time pane of System Preferences you can choose between displaying a digital or analog clock in the menu bar. For a digital clock there are five options that determine how the date and time are displayed:

UPDATE 2020-11-15: These instructions are for versions of macOS up to and including Catalina 10.15. If you have macOS Big Sur 11 or later installed please use the menu-bar-clock.sh shell script to set the date and time format of the menu bar clock from the command line.
  • Display the time with seconds
  • Use a 24-hour clock
  • Show AM/PM
  • Show the day of the week
  • Show date

There is a sixth option: Flash the time separators, which I’ve not included as I don’t consider this to be part of the date and time format.

Date & Time pane of System Preferences showing the Clock tab
Date & Time pane of System Preferences showing the Clock tab

 

 

These options can also be configured from the command line using the defaults command to edit the ~/Library/Preferences/com.apple.menuextra.clock.plist configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>DateFormat</key>
    <string>EEE d MMM HH:mm</string>
    <key>FlashDateSeparators</key>
    <false/>
    <key>IsAnalog</key>
    <false/>
</dict>
</plist>

 

 

The date format has no affect with an analogue clock. So firstly, to ensure a digital clock is displayed, set the value of the IsAnalog key to false. In Terminal type:

Dummy Content
defaults write com.apple.menuextra.clock IsAnalog -bool false

 

 

The value of the DateFormat key is a string which determines how the date and time are displayed. To set the date and time format to display Thu 18 Aug 23:46, in Terminal type:

Dummy Content
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm"

 

 

The table below details all the possible valid combinations of the five date and time format options in System Preferences together with an example of how the date and time are displayed for each and the corresponding string value for the DateFormat key. Note that Use a 24-hour clock and Show AM/PM are mutually exclusive options.

System Preferences Example
Date & Time
Display
String Value for
DateFormat
Key
Time Options Date Options
Display the time with seconds Use a
24-hour
clock
Show AM/PM Show
the day
of the
week
Show
date
Thu 18 Aug 23:46:18 EEE d MMM HH:mm:ss
Thu 23:46:18 EEE HH:mm:ss
18 Aug 23:46:18 d MMM HH:mm:ss
23:46:18 HH:mm:ss
Thu 18 Aug 11:46:18 pm EEE d MMM h:mm:ss a
Thu 11:46:18 pm EEE h:mm:ss a
18 Aug 11:46:18 pm d MMM h:mm:ss a
11:46:18 pm h:mm:ss a
Thu 18 Aug 11:46:18 EEE d MMM h:mm:ss
Thu 11:46:18 EEE h:mm:ss
18 Aug 11:46:18 d MMM h:mm:ss
11:46:18 h:mm:ss
Thu 18 Aug 23:46 EEE d MMM HH:mm
Thu 23:46 EEE HH:mm
18 Aug 23:46 d MMM HH:mm
23:46 HH:mm
Thu 18 Aug 11:46 pm EEE d MMM h:mm a
Thu 11:46 pm EEE h:mm a
18 Aug 11:46 pm d MMM h:mm a
11:46 pm h:mm a
Thu 18 Aug 11:46 EEE d MMM h:mm
Thu 11:46 EEE h:mm
18 Aug 11:46 d MMM h:mm
11:46 h:mm

 

 

The full list of examples are here.

To force the menu bar to reflect any changes made to the date and time format the process that controls the display of menu bar items – SystemUIServer – needs to be restarted. In Terminal type:

Dummy Content
killall SystemUIServer

 

 

Setting the date and time format and restarting the SystemUIServer process can be combined into a single command. In Terminal type:

Dummy Content
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm" && killall SystemUIServer

 

 

Finally, to flash the time separators in the time and date display set the value of the FlashDateSeparators key to true. In Terminal type:

Dummy Content
defaults write com.apple.menuextra.clock FlashDateSeparators -bool true && killall SystemUIServer

 

 

About the author

A native Brit exiled in Japan, Steve spends too much of his time struggling with the Japanese language, dreaming of fish & chips and writing the occasional blog post he hopes others will find helpful.

25 responses

25 Comments

  • Hello,

    Thanks for the article! Unfortunately, it’s not working in Ventura:
    defaults write com.apple.menuextra.clock DateFormat -string “EEE d MMM HH:mm” && killall SystemUIServer
    The clock format stays the same.

      • Thanks, I’ve tried this: ./menu-bar-clock.sh “EEE d MMM HH:mm” without success. I’m in Lithuania and I stiill see MM-DD WEEK_DAY HH:mm.

        • Hi John,

          A few things to check.

          First, what message is displayed when the script terminates?

          Next, in Terminal type
          defaults read com.apple.menuextra.clock.plist

          If you’ve used ./menu-bar-clock.sh "EEE d MMM HH:mm" this should show the following:

          DateFormat = "EEE d MMM HH:mm";
          FlashDateSeparators = 0;
          IsAnalog = 0;
          Show24Hour = 1;
          ShowAMPM = 0;
          ShowDate = 1;
          ShowDayOfWeek = 1;
          ShowSeconds = 0;

          Are the values you see the same?

          In System Settings > General > Language & Region what is your Preferred Languages (Primary) and your Region set to?

          Regards, Steve

          • >First, what message is displayed when the script terminates?

            I have this output:
            The menu bar clock format has been set to ‘EEE d MMM HH:mm’.
            The date portion (5 Nov) will always be shown.

            But I see 11-05 Sun HH:mm in Menu bar Clock

            >If you’ve used ./menu-bar-clock.sh “EEE d MMM HH:mm” this should show the following:

            Yes, that’s exactly what I see:
            % defaults read com.apple.menuextra.clock.plist
            {
            DateFormat = “EEE d MMM HH:mm”;
            IsAnalog = 0;
            Show24Hour = 1;
            ShowAMPM = 0;
            ShowDate = 1;
            ShowDayOfWeek = 1;
            ShowSeconds = 0;
            }

            Preferred Languages (Primary) is set to English and Region is Lithuania.

            Thanks!

          • Hi John,

            I’m also using Ventura. I set my region to Lithuania and I cannot replicate the menu bar date in the format you’re seeing. I see Sun 5 Nov 15:36 as expected.

            To test further, I ran defaults delete com.apple.menuextra.clock.plist. The menu bar displays 15:36. Then, in System Settings > Control Centre > Menu Bar Only > Clock > Clock Options… I set the options as per this image.

            The menu bar displays Sun 5 Nov 15:36.

            What seems odd is the format you’re seeing, particularly 11-05. There’s only one region setting I know of that produces a numeric month, and that’s Czechia – Sun 5. 11. 15:36. There maybe more, but Lithuania’s not one of them.

            It’s worth pointing out that the script only mimics what can otherwise be achieved through System Settings and is limited to the Apple-supplied date formats. Are you using any third-party apps that modify the appearance of the menu bar clock?

            Regards, Steve.

  • Thank you for this excellent investigation!

    I don’t understand Apple’s logic here… will macOS really not substitute a date in a date-format if ShowDayOfMonth is false? Any idea what was gained by adding all this complexity?

    I’m curious if this format will work for all times. I’m afraid of putting this into your tool and causing permanent damage. πŸ™

    E, MMM d, h:mm:ss a ‘[doy’D’, woy’w’] ‘

    • @Sanford,

      Apple only allow limited date formats to be used in the menu bar clock as detailed in the article or here. This is true for all macOS/Mac OS X versions.

      If you’re using the menu-bar-clock.sh script with Big Sur, it won’t allow you to use any other date formats.

      For Catalina and earlier, you can enter any date format using the defaults command in Terminal, but the DateFormat key will ultimately be set to an Apple-allowed format, probably as a result of the SystemUIServer process restarting.

      Regards, Steve.

  • Does this really work in Big Sur? I’ve issued the commands and verified it changes the contents of com.apple.menuextra.clock.plist and did killall SystemUIServer, but it has no effect. Even after a reboot.

    I would go with a utility like iClock or iStatMenu but Big Sur uses the clock to hide/show notifications.

  • Hi, Thanks for the great and useful info. Another option for people that aren’t technically adept is iClock what in addition to making the above available by drag n drop adds a whole bunch of time related features, like a menu of cities with local time, alarms, chimes, timers, countdown, moon phases, and more, going far beyond Apple’s Clock.

    https://plumamazing.com/product/iclock/

  • I’m running Mac OS Big Sur 11.0.1 and all menu items are black except for Menu Bar clock’s, which are white — making for an glaring contrast, and somewhat difficult to read. This happens regardless of whether the Light or Dark Appearance theme is used. Fortunately, there’s a new feature to automatically hide the menu bar so I don’t have to stare at it all the time.

  • Thank you for the Terminal command for setting the clock format! I use it to turn the clock into analog so it functions as a “Notification Center” button again, since Big Sur removed it. I use iStat Menus to provide the clock functionality too, as well as extra features like showing timezones when I click on it.
    [Imgur](https://i.imgur.com/i14YWzh.png)

  • Thank you soo much!!! I had changed the settings to use 24-hour time to try it out, only when I went back into System Preferences to change it back, for some reason, the settings were grayed out. So I’m really glad the terminal command worked, thank you!!

  • Thank you for a super helpful article.

    I have been using

    defaults write com.apple.menuextra.clock DateFormat “EEE MMM d h:mm:ss a”

    but I would like to add a literal β€˜@β€˜ sign between the β€˜d’ and the β€˜h:mm:ss’ – however, nothing I seem to try will work.

    I’ve tried things like

    defaults write com.apple.menuextra.clock DateFormat “EEE MMM d \@ h:mm:ss a”

    defaults write com.apple.menuextra.clock DateFormat “EEE MMM d β€˜@’ h:mm:ss a”

    but the β€˜@β€˜ just seems to be ignored.

    Do you know if there’s a way to do this?

    Thanks!

    • @TJ Luoma

      Unfortunately I don’t. I did try your examples and interestingly the string is added to the file com.apple.menuextra.clock.plist as is, but only temporarily. As part of some integrity check – perhaps performed by the SystemUIServer process restarting – the offending characters are removed from the DateFormat string.

      Regards, Steve.

  • Thanks for the wonderful article. Is there any way to display the Year in the Menu Bar? The Character Strings now looks like EEE D MMM HH:mm:ss. Any method to look it like EEE D MMM YYYY HH:mm:ss?

    • @Siddharth,

      Not that I’m aware of, but clicking the date in the menu bar does provide a drop-down showing the year.

      Regards, Steve.

    • @Vinayak,

      It’s working for me with Catalina. Remember, changes don’t take affect until the SystemUIServer process is restarted with killall SystemUIServer.

      Regards, Steve.

Steve

Recent Comments

Recent Posts