How to get rid of fractional seconds in find using -printf?
Solution 1:
You can truncate the fractional part using the %.n
formatting syntax, where n
is an integer specifying the length of the string you want to keep. In your particular case, the incantation would be:
find . -name '*.php' -printf '%TY-%Tm-%Td %TH:%TM:%.2TS %Tz %p\n' | sort -r | head -20