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...
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...
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.