get File Last Modified Date - Android java.io

Android examples for java.io:File

Description

get File Last Modified Date

Demo Code

import android.content.Context;
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static Date getLastModifiedDate(File file) {
        Date date = null;/*  ww w.j ava 2  s .c om*/
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(file.lastModified());
        date = calendar.getTime();
        return date;
    }

}

Related Tutorials