This question already has an answer here:
I'm building a java service that modifies the "Last Modified" field of some of the files it works with.
The service keeps copies of files in a folder, it periodically checks a database for changes, if it finds a file whose "last modified" timestamp in the database is newer than the one on the file system then it deletes the file from the file system, downloads a fresh copy and sets the "last modified" field on the file to match the one from the database.
This all works as expected. In the code I query an SQL
timestamp from the database, get the time as a
Long and pass that into the
file.setLastModified() method of the file object.
This works as expected, and when running comparisons both timestamps match as expected.
However, when I access the server via ssh and run
ls -l in the folder containing the files the last modified timestamp just says "2019"; BUT, if I run the
ls --full-time command then the full timestamp is displayed and is correct.
Why is this?
Is there some other flag I need to set when setting the timestamp on the file?
This is only an annoyance right now, I'm just curious as to why it looks this way.
Here's a screenshot of what it looks like: