List of utility methods to do Date Parse
Date | convertStrToDate(String day) convert Str To Date Date parse = dayParse.parse(day);
return parse;
|
Date | convertStrToDate(String s, String format) convert Str To Date SimpleDateFormat simpledateformat = new SimpleDateFormat(format); try { Date date = simpledateformat.parse(s); return date; } catch (Exception exception) { exception.printStackTrace(); Calendar cal = Calendar.getInstance(); cal.set(1900, 0, 1); ... |
Date | convertStrToDate(String source) convert Str To Date Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setLenient(false); try { date = sdf.parse(source); } catch (ParseException e) { return date; ... |
String | convertTFormatToCDATime(String tDate) convert T-format date to CDA format date. if (tDate == null || tDate.length() < 0) return null; if (tDate.equalsIgnoreCase("T")) convertToCDATime(Calendar.getInstance().getTime()); throw new Exception("Need to be implemented!"); |
String | convertTimeInMillisecondsToDate(long timeInMilliseconds) convert Time In Milliseconds To Date DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(timeInMilliseconds); return dateFormat.format(date); |
String | convertTimeStampToDate(String dateString, String srcFormat, String destFormat) This method converts the string timestamp to a date format by trimming of the time entry. if (srcFormat == null || destFormat == null || srcFormat.isEmpty() || destFormat.isEmpty()) { return ""; if (dateString == null || dateString.isEmpty()) { return ""; String[] tmpDate = dateString.split(" "); return changeDateFormat(tmpDate[0], srcFormat, destFormat); ... |
String | convertTimestampToDateTime(Long timestamp, Boolean withSeconds) convert Timestamp To Date Time String result = null; SimpleDateFormat sdf; if (withSeconds) { sdf = new SimpleDateFormat("MM/dd/yyyy(HH:mm:ss.SSS)"); } else { sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm"); Date resultdate = new Date(timestamp); ... |
Date | convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime) convert Time Zones To Date if (fromDateTime == null) { return null; DateTimeZone fromZone = DateTimeZone.forID(fromTimeZone); DateTimeZone toZone = DateTimeZone.forID(toTimeZone); DateTime dateTime = new DateTime(fromDateTime); dateTime = dateTime.withZoneRetainFields(fromZone); DateTime toDateTime = new DateTime(dateTime).withZone(toZone); ... |
String | convertUTCDateToLocal(String sDate, TimeZone timezone) Convert the given date following this roles:
if (sDate == null || sDate.equals("") || isInAllDayFormat(sDate)) { return sDate; if (timezone == null) { return sDate; if (!sDate.endsWith("Z")) { return sDate; ... |
Date | convertXMLDate(String date) convert XML Date if (date == null) return null; try { return xmlFormat.parse(date); } catch (ParseException e1) { return null; |