Here you can find the source of getTimestamp(final File file)
public static long getTimestamp(final File file)
//package com.java2s; import java.io.File; import java.text.DecimalFormat; import java.util.Calendar; public class Main { public static long getTimestamp(final File file) { final long modified = file.lastModified(); return Long.parseLong(timestamp(modified)); }//from w w w . j av a 2 s . c o m public static String timestamp(final long millis) { final Calendar date = Calendar.getInstance(); date.setTimeInMillis(millis); return timestamp(date); } public static String timestamp(final Calendar date) { final DecimalFormat format = new DecimalFormat("00"); final int month = date.get(Calendar.MONTH) + 1; final int day = date.get(Calendar.DAY_OF_MONTH); final int hour = date.get(Calendar.HOUR_OF_DAY); final int minute = date.get(Calendar.MINUTE); final int second = date.get(Calendar.SECOND); return "" + date.get(Calendar.YEAR) + format.format(month) + format.format(day) + format.format(hour) + format.format(minute) + format.format(second); } }