The date and time on your Mac is not something that we often think about. Actually, most users leave their Mac on the default automatic setting it so it’s not something that we normally worry about. But there are situations where you might need to do this.
While it can be done through the Time and Date section in your desktop settings, some may want to change using Mac Terminal. Doing it through the terminal application is quite easy and can be done in just a few steps.
My name is Eric and as a Software Engineer, I perform tasks like this on a daily basis. And I am still learning new things all the time. I love to do research on topics like this and I also enjoy learning from all the other users and readers out there.
If you want to learn about changing the date and time using Mac Terminal, keep reading and I will show you what I have learned.
Contents
Guide to Changing Date and Time on Mac via Terminal
Note: Using the sudo command before each of these commands will often require you to enter your password. This should be the password for the admin account you are using.
Step 1: Open Mac Terminal
Step 2: Turn off the setusingnetworktime feature
Turn off setusingnetworktime by typing the following command into the Terminal:
sudo systemsetup -setusingnetworktime off
Step 3: Figure out your date/time parameter
Determine your date and time parameter using the format [MM][DD][HH][MM][YY].
Example: April 15, 2022, 11:00 am would be 0415110022
Note: The time uses a 24-hour format.
Step 4: Use the date command to set the date and time.
Type the following command into your Mac Terminal to set the date and time.
sudo date [MM][DD][HH][MM][YY]
Using our example: sudo date 0415110022
Step 4: Verify the time was set
Type just the “date” command alone to verify the time was properly set.
date
How to Change the Timezone on Mac Terminal
Setting the timezone from Mac Terminal is just as easy as setting the date and time. You will first want to list the timezones so that you can find yours. If you want to set timezone to UTC, you won’t find UTC there. Remember that UTC is a standard, not a timezone.
GMT is the timezone that is the same time as UTC so if that is what you are looking for you can use GMT. All the other timezones are based on UTC and adjusted for their location around the world.
Just follow the steps below to set your timezone.
Step 1: View the List of Timezones
Use the systemsetup -listtimezones to see the list of valid timeszones you can set.
The list is quite long so you will want to use | more at the end of the command to keep them from all scrolling through the screen.
systemsetup -listtimezones | more
Just hit the space bar to move through the list.
Step 2: Set the time zone
Type sudo systemsetup -settimezone [your time zone], “your time zone is the name of the time zone you choose from the list in step 1.
We will use Denver, CO, USA for this example:
sudo systemsetup -settimezone America/Denver
Step 3: Verify the time zone has been set
Type the following command into the Terminal and hit enter to verify your time zone was correctly set. The terminal will output “Time Zone:” followed by its current time zone setting.
sudo systemsetup -gettimezone
FAQs
We get lots of questions about Mac settings, here are the most frequent ones related to date and time.
Why are the date and time wrong on my Mac?
There are a number of reasons the date and time on your Mac may be wrong. In most cases, it is that you don’t have the setting enabled to automatically set the time.
This can also happen with a Mac that does not have internet access and cannot connect to time.apple.com which sets the time.
Why won’t my Mac let me change the date and time?
To change the date and time, you must have administrative permissions on your Mac. You will also need to make sure that the setusingnetwroktime feature is turned off or you will not be able to change it.
You can check this by typing sudo sytemsetup -getusingnetworktime into the Mac Terminal. The command sudo systemsetup -setusingnetworktime off should turn it off.
How do I change the date format on my Mac?
You can change it from your desktop by going to System Preferences and then Language & Region. From there click on the Advanced button.
You will see a Dates tab which will allow you to specify the date format you see on your desktop and other places.
Final Words
Setting the date and time from Mac Terminal is fairly simple. Just keep in mind that you need to know the password for your admin account and you need to turn off the automatic time and date setting. I hope the information above can help you to set your time and date.
As usual, please let me know if you have any questions or comments. I would love to hear from you.
Stas
Hi Eric.
Need a help. What about non standard UTC time? I am a Seaman we often cross Pacific and we shift clock every second day. I really have no idea which city has for example UTC+11, or UtC-12, or UTC+6 (we usually have that time in Indian Ocean, yes we have that kind a time onboard, timezones Like GMT-8( Singapore, China) or -9 (Korea, Japan), Panama, Houston, London, central European time, Dubai, Qatar are well known, but what about “transit’ time?, Having android phones is not a problem, because there is a chance of choose time by UTC difference, not by city. But Mac, as usually, has it’s own way… help me to change timezone not by cities.
Eric
Hi Stas,
I can see how this can be very frustrating. I know how to set the time zone on a Mac but I am definitely not an expert on time zones or how they are set up. This sounds like a difficult problem. The only thing that I can think of is to find some kind of a reference that tells you cities that are near the UTC time zone you are in. I did find a reference on Wikipedia as shown below but I don’t know how accurate it is or if it can help.
https://en.wikipedia.org/wiki/List_of_UTC_offsets
I hope that this can provide some kind of help for you and that you can figure out a good way to set your clock. Good luck and thank you for the question.
Gavin
Hi Eric,
I am thinking to change my macbook to follow the 30 hour time format, any idea how I can do that?
Thank you.
Eric
Hi Gavin,
I am not familiar with the 30 hour time format. I do not know of any way to set your MacBook for that but if you find something let me know, I would love to hear about it.
Sebas
Hi Eric,
I did reset my MacBook and i don’t have any user or password so my command in the terminal start as -bash-3.2# what is the command to change the time zones from PST to GMT ?? Because i have an error so i cant reinstall it, i did change my time and date and i try some command for the time zones but it says ”command not found”
thanks in advance
Eric
Hi Sebas,
Basically the command should be as shown below:
systemsetup -settimezone GMT
It looks like you are logged in as root, but if not you will need to use sudo in front of the command like this:
sudo systemsetup -settimezone GMT
You will not be able to do this unless you have admin permissions and a password. Do you have an admin login for your MacBook? If you still cannot get this to work, you may want to try doing it from your desktop. Good luck! I hope this information can help.
Mario
Hi Eric,
Quick question: is there a way to just change the date without having to change or enter the time?
Thanks very much!
Eric
Hi Mario, this is a great question. I have done a little research on this and I don’t see a way to change just the date. When I get a chance, I will take a more in depth look and see if I can figure out a way to do this.
Mike
One small detail I noticed while looking through this is that the command for listing the time zones should have an “s” on the end. So I ran sudo systemsetup -listtimezones
Eric
Hi Mike,
Great catch! You are correct it should be -listtimezones with an s at the end. I really appreciate your feedback. We will get this updated as soon as possible to make sure that the information is accurate. Thank you very much!