Skip to main content
added 70 characters in body
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52

You can use stat(1) to get the modified time of a file, but this is not portable. On

On Linux:

$ stat -c %y some_file
2017-09-23 10:24:09.880806666 +0200

$ date -d @$(stat -c %Y some_file) +%d-%m-%Y
23-09-2017

On BSD:

$ stat -f %Sm -t %d-%m-%Y some_file
23-09-2017

You can use stat(1) to get the modified time of a file, but this is not portable. On Linux:

$ stat -c %y some_file
2017-09-23 10:24:09.880806666 +0200

On BSD:

$ stat -f %Sm -t %d-%m-%Y some_file
23-09-2017

You can use stat(1) to get the modified time of a file, but this is not portable.

On Linux:

$ stat -c %y some_file
2017-09-23 10:24:09.880806666 +0200

$ date -d @$(stat -c %Y some_file) +%d-%m-%Y
23-09-2017

On BSD:

$ stat -f %Sm -t %d-%m-%Y some_file
23-09-2017
Source Link
Satō Katsura
  • 13.7k
  • 2
  • 34
  • 52

You can use stat(1) to get the modified time of a file, but this is not portable. On Linux:

$ stat -c %y some_file
2017-09-23 10:24:09.880806666 +0200

On BSD:

$ stat -f %Sm -t %d-%m-%Y some_file
23-09-2017