



%e day of month, space padded same as %_d #Ubuntu find files by date full ^ use upper case if possible use opposite case if possible The following optional flags may follow `%': %x locale's date representation (e.g., 12/31/99)īy default, date pads numeric fields with zeroes. N.B.: These flags don't work on the " combo formats" like %F, %D and %x. They are for the " singular field formats".Īpparently this last flag ( #) does not work as I'd expect (e.g., if date +%b gives Oct, date +%#b gives OCT as opposed to oCT) I guess this would be useless, but I'd think a lower case option would be more useful. date +%#pdoes turn date +%p which might give PM or AM into pm or am, respectively. So I guess it's not a 'per-character' case switch but sets the case of all the characters in the string to the opposite case of the majority of the characters? Also date +%P gives pm or am, but neither date +%^P nor date +%#P change its output. My guess for this case is that %P is just an alias for %#p, and it seems that whenever you add more than one flag, the behavior is undefined/unpredictable ( e.g., date +%0-e gives the same as date +%-e: 3 and date +%-0e gives the same as date +%0e: 03, which makes you think that only the flag next to the letter works or that it goes left to right, but both date +%#^p and date +%^#p give pm or am, ) unless there's some hidden order of operations? Sorry for digressing.Īlso, if you run the command locale -k LC_TIME | grep ^d_fmt, you can see the combo for the specific locale of your system (e.g., d_fmt="%m/%d/%Y").Īnd you can make your own combo.Sometimes you may need to determine creation date for file & directory in Linux. However, as per POSIX standard, a file is supposed to have only last date of access, modification and status change. Newer filesystems such as ext4, zfs, btrfs, JFS, and XFS store creation date also. This information is stored in file inodes. In this article, we will learn how to get creation date for file & directory in Linux. How to Get Creation Date for File & Directory in Linux You can use these tools in almost every Linux distribution but they only work on newer filesystems mentioned earlier.
