My goal is to retrieve the birth time of a file formatted to "2019-07-03" so I'm using the following which yields the following epoch time instead of the specific date format I requested:

$ stat -f "%B" -t "%Y-%m-%d" ~/Pictures/to_backup/IMG_2115.JPEG

I get the same output if I leave out the time formatting entirely:

$ stat -f "%B" ~/Pictures/to_backup/IMG_2115.JPEG

I read through what seemed like the pertinent parts of the strftime and stat (<- this one in particular was a face melter) man pages.

What am I missing?

1 Answer 1


You need to place a S before B which converts the numerals (seconds since epoch) into string output.

stat -f "%SB" -t "%Y-%m-%d" ~/Pictures/to_backup/IMG_2115.JPEG
  • 1
    thank you! "read the man page carefully" is my new "read the stack trace carefully". Jul 3, 2019 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .