wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Get file created time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Get file created time" Watch "Get file created time" New topic
Author

Get file created time

Hui Zhao
Ranch Hand

Joined: Jul 09, 2007
Posts: 116

get
t1=0
It's strange.
if I define t1 as a Date format, I get
Wed Dec 31 19:00:00 EST 1969
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

According to the API, lastModified() returns a long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

Does the file exist? My guess is no.

Non-existent files have no modification date and no size (length).
[ September 26, 2007: Message edited by: Rob Prime ]

SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: Get file created time
 
Similar Threads
SEVERE: BAD packet signature 200,SEVERE: Caught exception (java.lang.NullPointerException)
Regular Expression help
renameTo()
Boolean Logic
Deadlocks in Threads?