/** * Formats the given date as an ISO 8601 date. * * @param date The date to format as ISO 8601. * @param format The date format to parse the string date * @param lenient Whether or not to leniently parse the date. */ public static String formatDate(String date, String format, boolean lenient) { return formatDate(date, format, false, null); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String, boolean)}, with the * {@code lenient} flag set to false. * * @param date The date to format as ISO 8601 * @param format The date format to parse the string date */ public static String formatDate(String date, String format) { return formatDate(date, format, false); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String, boolean, String)} with the * {@code lenient} flag set to false. * * @param date The date to format as ISO 8601 * @param format The date format to parse the string date * @param separator The separator for milliseconds */ public static String formatDate(String date, String format, String separator) { return formatDate(date, format, false, separator); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String, boolean)}, with the * {@code lenient} flag set to false. * * @param date The date to format as ISO 8601 * @param format The date format to parse the string date * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String format) { return formatDate(date, format, false); }
/** * Formats the given date as an ISO 8601 date. * * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code lenient} set to false and {@code separator} set to null. * * @param date The date to format as ISO 8601 * @param formats The date possible formats to parse the string date */ public static String formatDate(String date, String[] formats) { return formatDate(date, formats, false, null); }
/** * Formats the given date as an ISO 8601 date. * * @param date The date to format as ISO 8601. * @param format The date format to parse the string date * @param lenient Whether or not to leniently parse the date. * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String format, boolean lenient) { return formatDate(date, format, false, null); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code lenient} set to false. * * @param date The date to format as ISO 8601 * @param formats The date possible formats to parse the string date * @param separator The separator for milliseconds */ public static String formatDate(String date, String[] formats, String separator) { return formatDate(date, formats, false, separator); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String, boolean, String)} with the * {@code lenient} flag set to false. * * @param date The date to format as ISO 8601 * @param format The date format to parse the string date * @param separator The separator for milliseconds * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String format, String separator) { return formatDate(date, format, false, separator); }
/** * Formats the given date as an ISO 8601 date. * * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code lenient} set to false and {@code separator} set to null. * * @param date The date to format as ISO 8601 * @param formats The date possible formats to parse the string date * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String[] formats) { return formatDate(date, formats, false, null); }
/** * Formats the given date as an ISO 8601 date. * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code lenient} set to false. * * @param date The date to format as ISO 8601 * @param formats The date possible formats to parse the string date * @param separator The separator for milliseconds * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String[] formats, String separator) { return formatDate(date, formats, false, separator); }
/** * Formats the given date as an ISO 8601 date. * * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code separator} set to null. * * @param date The date to format as ISO 8601. * @param formats The date possible formats to parse the string date * @param lenient Whether or not to leniently parse the date. */ public static String formatDate(String date, String[] formats, boolean lenient) { return formatDate(date, formats, lenient, null); }
/** * Formats the given date as an ISO 8601 date. * * Delegates to {@link #formatDate(String, String[], boolean, String)} with * {@code separator} set to null. * * @param date The date to format as ISO 8601. * @param formats The date possible formats to parse the string date * @param lenient Whether or not to leniently parse the date. * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String[] formats, boolean lenient) { return formatDate(date, formats, lenient, null); }
/** * Formats the given date as an ISO 8601 date. * * @param date The date to format as ISO 8601. * @param formats The date possible formats to parse the string date * @param lenient Whether or not to leniently parse the date. * @param separator The separator for milliseconds */ public static String formatDate(String date, String[] formats, boolean lenient, String separator) { for (int i=0; i<formats.length; i++) { String result = formatDate(date, formats[i], lenient, separator); if (result != null) return result; } return null; }
/** * Formats the given date as an ISO 8601 date. * * @param date The date to format as ISO 8601. * @param formats The date possible formats to parse the string date * @param lenient Whether or not to leniently parse the date. * @param separator The separator for milliseconds * @return an ISO 8601 formatted timestamp */ public static String formatDate(String date, String[] formats, boolean lenient, String separator) { for (int i=0; i<formats.length; i++) { String result = formatDate(date, formats[i], lenient, separator); if (result != null) return result; } return null; }
protected Timestamp getDatestamp() { if (date != null && time != null) { try { return new Timestamp( DateTools.formatDate(date + " " + time, DATE_FORMAT)); } catch (Exception e) { LOGGER.debug("Failed to parse '" + date + " " + time + "'", e); } } return null; }
protected Timestamp getDatestamp() { if (date != null && time != null) { try { return new Timestamp( DateTools.formatDate(date + " " + time, DATE_FORMAT)); } catch (Exception e) { LOGGER.debug("Failed to parse '" + date + " " + time + "'", e); } } return null; }
private void fillAcquisitionDate(MetadataStore store, String date, int imageIndex) { if (date == null) return; if(DateTools.getTime(date, DateTools.FILENAME_FORMAT) != -1) { Timestamp stamp = new Timestamp( DateTools.formatDate(date, DateTools.FILENAME_FORMAT)); store.setImageAcquisitionDate(stamp, imageIndex); } }
private void fillAcquisitionDate(MetadataStore store, String date, int imageIndex) { if (date == null) return; if(DateTools.getTime(date, DateTools.FILENAME_FORMAT) != -1) { Timestamp stamp = new Timestamp( DateTools.formatDate(date, DateTools.FILENAME_FORMAT)); store.setImageAcquisitionDate(stamp, imageIndex); } }
private long getTimestamp(String file) throws FormatException, IOException { try (RandomAccessInputStream s = new RandomAccessInputStream(file, 16)) { TiffParser parser = new TiffParser(s); parser.setDoCaching(false); IFD firstIFD = parser.getFirstIFD(); if (firstIFD != null) { TiffIFDEntry timestamp = (TiffIFDEntry) firstIFD.get(IFD.DATE_TIME); if (timestamp != null) { String stamp = parser.getIFDValue(timestamp).toString(); stamp = DateTools.formatDate(stamp, BaseTiffReader.DATE_FORMATS, "."); Timestamp t = Timestamp.valueOf(stamp); return t.asInstant().getMillis(); // NPE if invalid input. } } } return new Location(file).lastModified(); }
private long getTimestamp(String file) throws FormatException, IOException { try (RandomAccessInputStream s = new RandomAccessInputStream(file, 16)) { TiffParser parser = new TiffParser(s); parser.setDoCaching(false); IFD firstIFD = parser.getFirstIFD(); if (firstIFD != null) { TiffIFDEntry timestamp = (TiffIFDEntry) firstIFD.get(IFD.DATE_TIME); if (timestamp != null) { String stamp = parser.getIFDValue(timestamp).toString(); stamp = DateTools.formatDate(stamp, BaseTiffReader.DATE_FORMATS, "."); Timestamp t = Timestamp.valueOf(stamp); return t.asInstant().getMillis(); // NPE if invalid input. } } } return new Location(file).lastModified(); }