How to Set Date Time from Mac Command Line

Working on a web extension that ships to an app store and isn’t immediately modifiable, like a website, can be difficult. Since you cannot immediately deploy updates, you sometimes need to bake in hardcoded date-based logic. Testing future dates can be difficult if you don’t know how to quickly change the date on your local […]

The post How to Set Date Time from Mac Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

Working on a web extension that ships to an app store and isn’t immediately modifiable, like a website, can be difficult. Since you cannot immediately deploy updates, you sometimes need to bake in hardcoded date-based logic. Testing future dates can be difficult if you don’t know how to quickly change the date on your local machine.

To change the current date on your Mac, execute the following from command line:

# Date Format:  MMDDYYYY
sudo date -I 06142024

This command does not modify time, only the current date. Using the same command to reset to current date is easy as well!

The post How to Set Date Time from Mac Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2024-06-17T12:01:38+00:00) How to Set Date Time from Mac Command Line. Retrieved from https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/

MLA
" » How to Set Date Time from Mac Command Line." David Walsh | Sciencx - Monday June 17, 2024, https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/
HARVARD
David Walsh | Sciencx Monday June 17, 2024 » How to Set Date Time from Mac Command Line., viewed ,<https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/>
VANCOUVER
David Walsh | Sciencx - » How to Set Date Time from Mac Command Line. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/
CHICAGO
" » How to Set Date Time from Mac Command Line." David Walsh | Sciencx - Accessed . https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/
IEEE
" » How to Set Date Time from Mac Command Line." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/. [Accessed: ]
rf:citation
» How to Set Date Time from Mac Command Line | David Walsh | Sciencx | https://www.scien.cx/2024/06/17/how-to-set-date-time-from-mac-command-line/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.