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

Advertisement
  • 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: _

Filed under

Related articles

Level up your Tech Career with DjamgaTech PRO

Download the DjamgaTech PRO App on the Apple App Store to access hundreds of interactive prep questions, flashcards, and quizzes cleanly without ads.

Djamgatech PRO App
Download DjamgaTech PRO on the App Store 🚀

← All articles