Touch change modified time including seconds [closed]
I am getting invalid date format 2011
when I try to the modified time, this works fine without the seconds
touch -t 2011 08 23 14 05 14 voucher.tpl
I am a little confused with the below that explains how to do this:
-t time specifies a particular time using this format:
[[[[cc]yy]MM]dd]hhmm[.ss]
where cc is the optional first 2 digits of the year, yy is the optional last 2 digits of the year, MM is the optional number of the month (01-12), dd is the optional day of the month, hh is the hour in 24 hour format (required), mm is the minutes (required), ss is the optional seconds.
$ touch -t 201108231405.14 voucher.tpl
$ ls -l --time-style='+%B %d %H:%M:%S' voucher.tpl
-rw-r--r-- 1 quanta quanta 0 August 23 14:05:14 voucher.tpl
Remove spaces. Also, you're missing the period between the mm and the ss. This will work:
touch -t 201108231405.14 voucher.pl
touch -t 201108231405.14 voucher.tpl
should work. It did for me.
Note that the time format specification does not include any spaces.
You are using the wrong format.
This should work fine:
touch -t 201108231405.14 voucher.tpl
-t STAMP
use
[[CC]YY]MMDDhhmm[.ss]
instead of current time