Skip to main content
added 1 character in body
Source Link
Edgar Magallon
  • 5.2k
  • 3
  • 15
  • 29

Using date you specify the following format:

date -r test.txt +'%Y%m%d%H%M%S'+'%Y%m%d%H%M.%S' 
  1. %Y: Year (with four digits)
  2. %m: Month number (with two digits)
  3. %d: Day (with two digits)
  4. %H: Hour (from 00 to 23)
  5. %M: Minutes
  6. %S: Seconds

You can check man date to more information.

Using date you specify the following format:

date -r test.txt +'%Y%m%d%H%M%S' 
  1. %Y: Year (with four digits)
  2. %m: Month number (with two digits)
  3. %d: Day (with two digits)
  4. %H: Hour (from 00 to 23)
  5. %M: Minutes
  6. %S: Seconds

You can check man date to more information.

Using date you specify the following format:

date -r test.txt +'%Y%m%d%H%M.%S' 
  1. %Y: Year (with four digits)
  2. %m: Month number (with two digits)
  3. %d: Day (with two digits)
  4. %H: Hour (from 00 to 23)
  5. %M: Minutes
  6. %S: Seconds

You can check man date to more information.

Source Link
Edgar Magallon
  • 5.2k
  • 3
  • 15
  • 29

Using date you specify the following format:

date -r test.txt +'%Y%m%d%H%M%S' 
  1. %Y: Year (with four digits)
  2. %m: Month number (with two digits)
  3. %d: Day (with two digits)
  4. %H: Hour (from 00 to 23)
  5. %M: Minutes
  6. %S: Seconds

You can check man date to more information.