I usually do it through the System Preference panel for Date & Time, but I'd like a quicker way to do this if there is one.

有帮助吗?

解决方案

Use the following Terminal command:

sudo systemsetup -settimezone timezone

For a list of valid timezone values, use sudo systemsetup -listtimezones.

To get the current timezone, use:

sudo systemsetup -gettimezone

其他提示

Additionally:

Printing a random timezone:

ruby -e "puts `sudo systemsetup -listtimezones`.lines.sample.strip"

Setting a random timezone:

sudo systemsetup -settimezone (ruby -e "puts `sudo systemsetup -listtimezones`.lines.sample.strip")

Finding a timezone (e.g. containing "Los" in this case):

sudo printf ''; sudo systemsetup -listtimezones | grep Los
许可以下: CC-BY-SA归因
不隶属于 apple.stackexchange
scroll top