Here you can find the source of getFormattedFileTime(File f, String format)
Parameter | Description |
---|---|
f | a parameter |
format | a parameter |
public static String getFormattedFileTime(File f, String format)
//package com.java2s; import java.io.File; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**/*from ww w. j a v a2 s. c o m*/ * @param f * @param format * @return */ public static String getFormattedFileTime(File f, String format) { try { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(f.lastModified()); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(cal.getTime()); } catch (SecurityException ignored) { return ""; } } }