What is a timestamp in Linux?
While reading about Linux I got the following:
touch provides several options, but here is one of interest:
The -t option allows you to set the date and time stamp of the file. To set the time stamp to a specific time:
$ touch -t 03201600 myfile
This sets the file, myfile's, time stamp to 4 p.m., March 20th (03 20 1600).
Here, I am not getting the logic behind 03201600 --> 4pm, March 20th.
Solution 1:
Welcome to Linux! You probably read that touch
text you quoted in your question from a guide or a book.
In Linux, almost every command has a "manual" that explains its options. You can view the manual page of any command by executing man <command>
on a Linux machine.
So, from the command man touch
:
-t STAMP
use [[CC]YY]MMDDhhmm[.ss] instead of current time
So, your example:
-t 03201600 #Breaking it down: -t 03 20 16 00 -t MM DD hh mm -t month day hours minutes
So March 20th, 4pm (24-hour format).
If you don't have access to a Linux machine, you can view these man
pages online from here: http://unixhelp.ed.ac.uk/CGI/man-cgi. The man
page for the command touch
is found here: http://unixhelp.ed.ac.uk/CGI/man-cgi?touch
Solution 2:
The output you posted explains the format by breaking apart the numbers as (03 20 1600):
03 - March
20 - 20th
1600 - 4:00 PM (24-hour clock, where 0000 is midnight)
Solution 3:
According to man touch
:
-t STAMP
use [[CC]YY]MMDDhhmm[.ss] instead of current time
So, your timestamp can be translated to DD/MM hh:mm
: 20/03 16:00.