Java File Time Get getFileLastModified(File file)

Here you can find the source of getFileLastModified(File file)

Description

get File Last Modified

License

Apache License

Declaration

public static String getFileLastModified(File file) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String getFileLastModified(File file, String format) {
        Date date = new Date(file.lastModified());
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date).toString();
    }//from  w  w  w .  j ava2  s  .  c o m

    public static String getFileLastModified(File file) {
        return getFileLastModified(file, "yyyy-MM-dd HH:mm:ss");
    }
}

Related

  1. getFileLastModified(File file)
  2. getFileTimestamp(long timeStampinMillis)