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.
- Guide to Changing Data and Time on Mac via Terminal
- How to Change the Timezone on Mac Terminal
- Final Words
Guide to Changing Data 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.
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 -listtimezone | 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
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.
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.