Terminal 101: Change and View Date from Command Line

Every Monday, we’ll show you how to do something new and simple with Apple’s built-in command line application. You don’t need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type ’em out!

Sometimes you may need to update the system time from the command line, particularly if you encounter issues booting into the OS X recovery partition if your Mac has been sitting for a while and the system date is incorrect. Fortunately, this is something that is easily changed in OS X using a bit of Terminal-ology, as you will see in this article. Continue reading, and we’ll show you how to switch your system date to the correct date using a simple date command.

Viewing the Date

To view the currently set system date, open the Terminal (located in /Applications/Utilities), and type the following command followed by the enter key:

date

Yep, that’s all. The date will be outputted to the console for your viewing pleasure. This is the date that is set in the operating system and stored via battery backup when the computer is powered off.

Setting the Date

Now, if you need to set the date on your system to the current correct date, you’ll need to know the format that is required by the date command:

date {month}{day}{hour}{minute}{year}

You’ll replace each of the brackets above with the a two-digit number that represents the month, day, hour, minute, and year in that order. Don’t include spaces.

For example, if you wanted to set the system date to April 12, 2014 12:10, you would enter the following command into the Terminal:

date 0412121014

When you press return, you can see that the date was set correctly by executing the date command to view the date.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article’s author on Twitter.