Menu

File last modified date and time

Help
Saranya
2019-09-19
2019-09-24
  • Saranya

    Saranya - 2019-09-19

    How to get a remote file's last modified time? I am using the following but it shows date with year 1970 only.

    int mtime = entry.getAttrs().getMTime();
    Date date = new Date (mtime);
    

    When printed the date is "Mon Jan 19 09:09:10 IST 1970". What should be changed here to find the exact last modified time?

     
  • Saranya

    Saranya - 2019-09-24

    I was able to resolve this using the following

    new Date((long)file.getAttrs().getMTime()*1000L)
    

    where file is an instance of ChannelSftp.LsEntry

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.