Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

File Modification time..  RSS feed

 
Ranch Hand
Posts: 151
Java MyEclipse IDE Python
  • Mark post as helpful
  • send pies
  • Report post to moderator
i have text file that i m modifying after an interval but i m getting the same time after modification too here is the code

import java.io.File;
import java.sql.Time;
import java.util.Date;

public class Execute {
//private LoadLinkifyIndeedTerm myThread;

public static void main(String[] args) {
// Create an instance of file object.
File file = new File("test.txt");
// Get the last modification information.
Long lastModified = file.lastModified();

// Create a new date object and pass last modified information
// to the date object.
Date date = new Date(lastModified);
Time time= new Time(lastModified);

// We know when the last time the file was modified.
System.out.println(date);
System.out.println(time);
}
}


i want to kknow the last modification time of the file
thanks in advance
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Do not duplicate threads. Continue there.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!