Get the "last modified" date from a fileTag(s): IO

Simply use the lastModified() method from a file object. but the return value is system dependent and should only be used to compare with other values returned by last modified. It should not be interpreted as an absolute time.
String s1 = "file1.dat";
String s2 = "file2.dat";

File f1 = new File(s1);
File f2 = new File(s2);

if (f1.lastModified() < f2.lastModified())
System.out.println((s1 + " IS OLDER THAN " + S2);



If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]