25 March 2021
In Unix/Linux operating system it is possible to modify or change timestamp of a file using touch
command.
Example:
$ touch -t 197001020304.05 example-change-date.txt
Where the date format is [[CC]YY]MMDDhhmm[.ss] :
- [[CC]YY] = 1970, Year
- MM = 01, Month
- DD = 02, Day of the month
- hh = 03, Hour of the day in 24 format, so 1AM --> 01 and 1PM --> 13
- mm = 04, Minutes
- [.ss] = 05, Seconds
$ docker run -it ubuntu /bin/bash
root@37748a763085:/# cd /tmp
root@37748a763085:/tmp# touch example-change-date.txt
root@37748a763085:/tmp# ls --full-time
total 0
-rw-r--r-- 1 root root 0 2021-03-25 20:32:39.077535888 +0000 example-change-date.txt
root@37748a763085:/tmp# touch -t 197001020304.05 example-change-date.txt
root@37748a763085:/tmp# ls --full-time
total 0
-rw-r--r-- 1 root root 0 1970-01-02 03:04:05.000000000 +0000 example-change-date.txt
man touch