Here you can find the source of parseTimestampDirectory(final String stamp)
public static Date parseTimestampDirectory(final String stamp) throws ParseException
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { private static final String TSDIR_SECONDS_FORMAT = "yyyyMMdd_HHmmss"; private static final String TSDIR_MILLISECONDS_FORMAT = "yyyyMMdd_HHmmssSSS"; public static Date parseTimestampDirectory(final String stamp) throws ParseException { final DateFormat format; if (stamp.length() == 18) { format = new SimpleDateFormat(TSDIR_MILLISECONDS_FORMAT); } else {/*from www. j a va 2s. c om*/ format = new SimpleDateFormat(TSDIR_SECONDS_FORMAT); } return format.parse(stamp); } }