sometimes im working with a web extension that needs hardcoded dates for testing future scenarios. but updating it isnt always easy since we cant deploy changes right away ⚠️ Changing these tests manually is tricky, so knowing how quickly tweak the system clock on my local machine comes in handy
heres what you do: open terminal and type this command:
sudo date -s "YYYY-MM-DD HH:mm:ss"
replace YYYY with year (2035), MM for month(1-12) DD day of the mo. 4 digits, H is hour in a military time format.
for example:
$ sudo date -s '2026-08-17 9:45'
this sets my mac's clock to august 17th at nine forty-five am ⏰
anyone else run into issues with hardcoded dates in their projects? or do you have any other neat tricks for testing future scenarios without changing your code directly
full read:
https://davidwalsh.name/mac-set-date