To set the time in Ubuntu from the terminal, you can use the following command:
sudo date new_date_time_string
where new_date_time_string
has to follow the format MMDDhhmmyyyy.ss
which is described below:
MM
is a two digit month, between 01 to 12
DD
is a two digit day, between 01 and 31, with the regular rules for days according to month and year applying
hh
is two digit hour, using the 24-hour period so it is between 00 and 23
mm
is two digit minute, between 00 and 59
yyyy
is the year; it can be two digit or four digit
ss
is two digit seconds. Notice the period .
before the ss
.
Source: Manage Time in Ubuntu Through Command Line.
So, in your particular case, you can use:
sudo date 010224311971.59
Or, you can use:
sudo date --set="1971-01-02 23:31:59.990" && date --rfc-3339=ns
which is exactly what you asked.
Source: