1

For some reason I fail to update year only using date command

date
Tue Mar  4 20:15:42 IST 2014

date '+%Y' -s '2013'

date
Tue Mar  4 20:13:01 IST 2014

I tried it on both RedHat and Ubuntu...

NTP is not running...

tshepang
  • 12,111
  • 21
  • 91
  • 136
Gregory Danenberg
  • 519
  • 2
  • 9
  • 15
  • This question appears to be off-topic because it is about Linux administration: possibly try unix.stackexchange.com – Adrian Cox Mar 04 '14 at 11:01

1 Answers1

5

Apparently to change the date you have to use the complete setting syntax.

date --set="YYYYmmdd HH:MM"

Here is a way to achieve your demand :

date --set="$(date +'2013%m%d %H:%M')"

This way you maintain month, day, hour and minute and change year.

Nicocube
  • 2,962
  • 2
  • 20
  • 28