File editing

i cant get it to pull the last modified date

Page 1 of 1

1 Replies - 1023 Views - Last Post: 11 April 2007 - 09:37 AM Rate Topic: -----

#1 Donnie16  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 09-April 07

File editing

Post icon  Posted 11 April 2007 - 08:40 AM

i need to get a setLastModified to work
[code]
/*
* Main.java
*
* Created on April 11, 2007, 8:24 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package workingwithfiles;
import java.io.*;
import java.util.*;

/**
*
* @author dseech
*/
public class Main {

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
File filearrays=new File ("X:\\christmas.bmp");
File newChristmas07=new File ("X:\\newChristmas07.bmp");
String setLastModified;

System.out.println("File exists!! "+ filearrays.exists());
System.out.println("canWrite "+ filearrays.canWrite());
System.out.println("canRead "+ filearrays.canRead());
System.out.println("canWrite "+ filearrays.canWrite());
System.out.println("length "+ filearrays.length());
System.out.println("isDirectory "+ filearrays.isDirectory());
System.out.println("getParent "+ filearrays.getParent());
System.out.println("getAbsolutePath "+ filearrays.getAbsolutePath());
System.out.println("getPath " + filearrays.getPath());
System.out.println("getName " + filearrays.getName());
System.out.println("isFile " + filearrays.isFile());
System.out.println("isAbsolute " + filearrays.isAbsolute());
filearrays.renameTo(newChristmas07);
System.out.println("setReadOnly " + filearrays.setReadOnly());
System.out.println(" isHidden " + filearrays.isHidden());
System.out.println("setLastModified" + filearrays.setLastModified("April 11, 2007 09:22:11:00"));



}

}
[\code]

Is This A Good Question/Topic? 0
  • +

Replies To: File editing

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: File editing

Posted 11 April 2007 - 09:37 AM

setLastModified takes a long data type as a parameter...not a string.

http://java.sun.com/...tModified(long)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1