Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

4 Answers 4

up vote 3 down vote accepted
$ 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
share|improve this answer
add comment

touch -t 201108231405.14 voucher.tpl should work. It did for me.

Note that the time format specification does not include any spaces.

share|improve this answer
add comment

You are using the wrong format this should work ok

touch -t 201108231405.14 voucher.tpl

-t STAMP

          use [[CC]YY]MMDDhhmm[.ss] instead of current time
share|improve this answer
add comment

Remove spaces. Also, you're missing the period between the mm and the ss. This will work:

touch -t 201108231405.14 voucher.pl
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.