
Patrick B. answered 10/12/20
Math and computer tutor/teacher
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
change the format string
Henry E.
asked 10/12/20package filestatistics2;
import java.io.File;
import java.util.*;
import java.text.*;
public class FileStatistics2
{
private static Object f;
public static void main(String[] args)
{
final Formatter sup;
try
{
sup = new Formatter("FileStatistics.java");
File f = new File("C:\\Users\\saint\\Desktop\\FileStatistics.java");
String fileName = f.getName();
long fileSize = f.length();
System.out.println("Filename:" + "FileStatistics.Java");
System.out.println("FileStatistics.java's size is: " + fileSize + " bytes");
System.out.println("The file's folder location is: " + f.getPath());
long lastModified = 0;
Date d = new Date(lastModified);
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
System.out.println("Modified: " + sdf.format(d));
System.out.println("File created ^-^!");
}
catch (Exception e) {
System.out.println("error occured! @^@'");
System.out.println("File Not created ;^;!");
}
}
}
Patrick B. answered 10/12/20
Math and computer tutor/teacher
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
change the format string
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.