The clock in the menu bar is actually an additional menu whose path: /System/Library/CoreServices/Menu Extras/Clock.menu
In addition to changing the ClockEnabled com.apple.MenuBarClock key, you also need to change the list of additional menus by changing the menuExtras com.apple.systemuiserver key.
For example, the following command will add an additional clock menu:
defaults write com.apple.systemuiserver menuExtras -array-add "/System/Library/CoreServices/Menu Extras/Clock.menu"
The tricky part is -array-remove clock menu again, because by default they do not have the -array-remove option, you need to overwrite the entire array with the -array option.
Once the changes have been made, it is enough to send a hang signal to SystemUIServer:
killall SystemUIServer -HUP
To programmatically open the Date and Time system preferences panel, you can use the following AppleScript:
tell application "System Preferences" set current pane to pane id "com.apple.preference.datetime" end tell
sakra source share