List of utility methods to do Date Parse
Date | getDateFromDatestamp(String datestamp) Converts an ISO8601 UTC datestamp String of the form yyyy-MM-ddTHH:mm:ssZ or the short form yyyy-MM-dd to a Java Date. return getDateFromDatestamp(datestamp, 0);
|
Date | getDateFromDateTimeUTCFormat(final String dateString) get Date From Date Time UTC Format try { return getDateTimeUTCFormat().parse(dateString); } catch (ParseException e) { throw new RuntimeException(e); |
Date | getDateFromDCItemTimestamp(String dateTimeStamp) get Date From DC Item Timestamp Date dateTime = null; if (dateTimeStamp != null && dateTimeStamp.length() > 0) { SimpleDateFormat ISO8601Local = new SimpleDateFormat("yyyyMMddHHmmss"); TimeZone timeZone = TimeZone.getDefault(); ISO8601Local.setTimeZone(timeZone); try { dateTime = (Date) ISO8601Local.parse(dateTimeStamp.trim()); } catch (ParseException e) { ... |
Date | getDateFromFileName(String fileName) get Date From File Name int start = fileName.lastIndexOf("__"); int length = fileName.length(); if (start != -1) start = fileName.lastIndexOf("__", start - 1); int end = fileName.lastIndexOf("."); start = (start == -1) ? 0 : start + 2; if (end == -1) end = length; ... |
String | getDateFromFormat(Date date, String type) get Date From Format SimpleDateFormat dateForma = getSimpleDateFormatsType(type);
return dateForma.format(date);
|
Date | getDateFromFormattedDate(String dateStr, String format) get Date From Formatted Date try { SimpleDateFormat sdf = new SimpleDateFormat(format); if (dateStr != null && !"XXXX".equals(dateStr)) { Date date = sdf.parse(dateStr); return date; } catch (ParseException pe) { System.out.println("Exception: " + pe); ... |
Date | getDateFromFormattedTimeStamp(String formattedTimeStamp) get Date From Formatted Time Stamp SimpleDateFormat date = new SimpleDateFormat(MARTUS_SIGNATURE_FILE_DATE_FORMAT); return date.parse(formattedTimeStamp); |
Date | getDateFromIRODSValue(final String irodsValue) Utility to return an irods date value as a java.util.Date
if (irodsValue == null) { throw new IllegalArgumentException("null date value"); if (irodsValue.isEmpty()) { return null; Integer dateInteger; try { ... |
Date | getDateFromISO8601(Object iso8601) get Date From ISO if (iso8601 == null) return null; String sdate = iso8601.toString(); final int a = sdate.indexOf('Z') >= 0 ? 2 : 0; final int b = sdate.indexOf('T') >= 0 ? 1 : 0; SimpleDateFormat formatter = s_formats[3 - a - b]; synchronized (formatter) { return formatter.parse(sdate); ... |
Date | getDateFromISO8601(String dateString) Gets a Date object from the dateString
String tz = "-08:00"; if (dateString.endsWith(":00")) { tz = dateString.substring(dateString.length() - 6); String dateNoTimeZone = dateString.substring(0, dateString.length() - 6); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); TimeZone timezone = TimeZone.getTimeZone("GMT" + tz); Calendar cal = Calendar.getInstance(timezone); ... |