Set Date and time via command line

Let’s find out how to set Date and time via command line on linux and windows:

  • On Linux via terminal

    System time (Must have sudo privilege)
    date -s ‘2015-07-28 15:27:30’
    Hardware time
    Let’s set the hardware clock to the current system time:
    hwclock –systohc

  • On Windows via command prompt terminal

    System time (Must have Administrator privilege)
    date
    The current date is: 07/28/2015
    Enter the new date: (mm-dd-yy)_
    time
    The current time is: 15:34:03.44
    Enter the new time: _