class SnapshotUtil {

    static long getSnapshotTimestamp(String snapshotName) {
        try {
            String suffix = snapshotName.substring(snapshotName.length() - 16);
            if (suffix.startsWith(Snapshot.TIMESTAMP_PREFIX)) {
                return Snapshot.DATE_FORMAT_SNAPSHOT.parse(suffix.substring(2)).getTime();
            } else {
                // invalid snapshot name format
                return 0;
            }
        } catch (Throwable e) {
            // invalid snapshot name format
            return 0;
        }
    }

}