/** Converts the given timestamp into a date string with the given format. */ public static String convertDate(long stamp, int format, String outputFormat) { return convertDate(stamp, format, outputFormat, false); }
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); } }
/** * Converts a string date in the given format to a long timestamp * (in Unix format: milliseconds since January 1, 1970) with special * milliseconds handling. * * @param date The date to convert * @param format The date format to parse the string date * @param separator The separator for milliseconds * @return The date in milliseconds */ public static long getTime(String date, String format, String separator) { Instant timestamp = parseDate(date, format, separator); if (timestamp == null) { return -1; } else { return timestamp.getMillis(); } }
stamp += DateTools.getTime(date, DateTools.ISO8601_FORMAT); date = DateTools.convertDate(stamp, (int) DateTools.UNIX_EPOCH);
/** * 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); }
String date = DateTools.formatDate(creationTime, SHORT_DATE_FORMAT, "."); if (date != null) { store.setImageAcquisitionDate(new Timestamp(date), 0); String date = DateTools.convertDate(DateTools.getTime( timestamps.get(t), SHORT_DATE_FORMAT, "."), DateTools.UNIX, SHORT_DATE_FORMAT + ".SSS"); startDate = DateTools.getTime(timestamps.get(0), SHORT_DATE_FORMAT, "."); if (coords[2] < timestamps.size()) index = coords[2]; String stamp = timestamps.get(index); long ms = DateTools.getTime(stamp, SHORT_DATE_FORMAT, "."); deltaT = (ms - startDate) / 1000.0;
date = DateTools.formatDate(date.trim(), new String[] {"dd/MM/yyyy hh:mm:ss a", "MM-dd-yyyy hh:mm:ss","dd/MM/yyyy H:mm:ss"}, true); Timestamp timestamp = Timestamp.valueOf(date); long stamp = ms + (long) (stamps[timeIndex][i] * 1000); addGlobalMeta(key, DateTools.convertDate(stamp, DateTools.UNIX, DATE_FORMAT));
/** * Converts a string date in the given format to a long timestamp * (in Unix format: milliseconds since January 1, 1970). * * @param date The date to convert * @param format The date format to parse the string date * @return The date in milliseconds */ public static long getTime(String date, String format) { return getTime(date, format, null); }
long low = stampLow == null ? 0 : Long.parseLong(stampLow); long ms = DateTools.getMillisFromTicks(high, low); if (count == 0) { String date = DateTools.convertDate(ms, DateTools.COBOL); Timestamp timestamp = Timestamp.valueOf(date); if (timestamp != null && timestamp.asInstant().getMillis() <
log.println("Bio-Formats Plugins configuration - " + DateTools.getTimestamp());
private String getNewFileName() { final int lastDotIndex = this.fileName.lastIndexOf("."); String newFileName = ""; String timestamp = "-" + DateTools.getFileTimestamp(); if (lastDotIndex != -1) { newFileName = this.fileName.substring(0, lastDotIndex) + timestamp + this.fileName.substring(lastDotIndex); } else { newFileName = this.fileName + timestamp; } return newFileName; } }
stamp += DateTools.getTime(date, DateTools.ISO8601_FORMAT); date = DateTools.convertDate(stamp, (int) DateTools.UNIX_EPOCH);
/** * 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); }
String date = DateTools.formatDate(creationTime, SHORT_DATE_FORMAT, "."); if (date != null) { store.setImageAcquisitionDate(new Timestamp(date), 0); String date = DateTools.convertDate(DateTools.getTime( timestamps.get(t), SHORT_DATE_FORMAT, "."), DateTools.UNIX, SHORT_DATE_FORMAT + ".SSS"); startDate = DateTools.getTime(timestamps.get(0), SHORT_DATE_FORMAT, "."); if (coords[2] < timestamps.size()) index = coords[2]; String stamp = timestamps.get(index); long ms = DateTools.getTime(stamp, SHORT_DATE_FORMAT, "."); deltaT = (ms - startDate) / 1000.0;
date = DateTools.formatDate(date.trim(), new String[] {"dd/MM/yyyy hh:mm:ss a", "MM-dd-yyyy hh:mm:ss","dd/MM/yyyy H:mm:ss"}, true); Timestamp timestamp = Timestamp.valueOf(date); long stamp = ms + (long) (stamps[timeIndex][i] * 1000); addGlobalMeta(key, DateTools.convertDate(stamp, DateTools.UNIX, DATE_FORMAT));
/** * Converts a string date in the given format to a long timestamp * (in Unix format: milliseconds since January 1, 1970). * * @param date The date to convert * @param format The date format to parse the string date * @return The date in milliseconds */ public static long getTime(String date, String format) { return getTime(date, format, null); }
long low = stampLow == null ? 0 : Long.parseLong(stampLow); long ms = DateTools.getMillisFromTicks(high, low); if (count == 0) { String date = DateTools.convertDate(ms, DateTools.COBOL); Timestamp timestamp = Timestamp.valueOf(date); if (timestamp != null && timestamp.asInstant().getMillis() <
log.println("Bio-Formats Plugins configuration - " + DateTools.getTimestamp());
stamp += DateTools.getTime(date, DateTools.ISO8601_FORMAT); date = DateTools.convertDate(stamp, (int) DateTools.UNIX_EPOCH);
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); } }