The way to Set Date Time from Mac Command Line


Engaged on an internet extension that ships to an app retailer and is not instantly modifiable, like an internet site, will be troublesome. Since you can’t instantly deploy updates, you typically must bake in hardcoded date-based logic. Testing future dates will be troublesome if you do not know the right way to rapidly change the date in your native machine.

To vary the present date in your Mac, execute the next from command line:

# Date Format:  MMDDYYYY
sudo date -I 06142024

This command doesn’t modify time, solely the present date. Utilizing the identical command to reset to present date is straightforward as effectively!

  • Create Spinning Rays with CSS3: Revisited
  • Animating CSS3 Transforms with MooTools Fx
  • Create a NoScript Compatible Select Form Element with an onChange Event
  • Create a Simple Slideshow Using MooTools

    One glorious manner so as to add dynamism to any web site is to implement a slideshow that includes photos or sliding content material. In fact there are quite a few slideshow plugins out there however a lot of them will be overkill if you wish to do easy slideshow with out controls or occasions.

  1. Richard

    I didn’t perceive your actual use case, however a useful strategy to do date-related testing with out modifying your precise laptop date/time, is to shim the system calls with library pre-loading. On a Mac, dyld can do that with DYLD_LIBRARY_PATH. On Linux, GNU ld can do it with LD_LIBRARY_PATH.

    This makes it straightforward to jot down exams for particular conditions, comparable to month-to-month changeovers, leap-occurrences, timezones, and so forth.

    “libfaketime” is a helpful library written for this, https://github.com/wolfcw/libfaketime. It’s even packaged in homebrew, simply do brew set up libfaketime. 🙂


Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles