skip to Main Content

I am trying to set current date in Ubuntu 22.04 using:

date -s YY/MM/DD

but I am getting error:

date: invalid date ‘YY/MM/DD’

2

Answers


  1. you want to change the systemtime?

    then you need to use timedatectl.

    for example:

    sudo timedatectl set-time "YYYY-MM-DD HH:MM:SS"
    

    you can check if it worked by

    timedatectl
    
    Login or Signup to reply.
  2. you don’t seem to be setting in values, rather you’re passing in the format

    perhaps try this solution:

    sudo date --set="2015-09-30 10:05:59.990"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search