List of utility methods to do Date String to Date Convert
String | getDateOffset(String date, int offset) get Date Offset Date tempDate = null; if (date.indexOf("/") > 0) tempDate = getDateObj(date, "[/]"); if (date.indexOf("-") > 0) tempDate = getDateObj(date, "[-]"); tempDate = getDateAdd(tempDate, offset); return getFormatDateTime(tempDate, "yyyy/MM/dd"); |
String | getDateTomorrow(String date) get Date Tomorrow Date tempDate = null; if (date.indexOf("/") > 0) tempDate = getDateObj(date, "[/]"); if (date.indexOf("-") > 0) tempDate = getDateObj(date, "[-]"); tempDate = getDateAdd(tempDate, 1); return getFormatDateTime(tempDate, "yyyy/MM/dd"); |
String | convertStandardDateTime(String time) convert Standard Date Time String standardResult = ""; try { time = time + "000"; long tmpTime = Long.parseLong(time); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); standardResult = sdf.format(new Date(tmpTime)); } catch (Exception e) { ... |
String | removeTimeZone(String data) remove Time Zone return data.replaceFirst("(\\s[+|-]\\d{4})", ""); |
long | parseFileName(String timeStr) Parse system time from string in the format "yyyyMMdd-HHmmss-SSS", return new SimpleDateFormat("yyyyMMdd-HHmmss-SSS", Locale.US) .parse(timeStr).getTime(); |
String | formatDate(String date) format Date SimpleDateFormat input = new SimpleDateFormat(INPUT_DATE_FORMAT); SimpleDateFormat output = new SimpleDateFormat( "dd/MM/yyyy HH::mm:ss"); Date d; try { d = input.parse(date); return output.format(d); } catch (ParseException e) { ... |
Date | changeStringToDate(String fecha, String pattern) change String To Date DateFormat formato = new SimpleDateFormat(pattern); return formato.parse(fecha); |
String | changeStringToDate1(String str) change String To Date SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date date6 = null; try { date6 = sdf.parse(str); return date6.toString(); } catch (ParseException e) { e.printStackTrace(); return ""; ... |
String | changeStringToDate2(String str) change String To Date SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date date6 = null; try { date6 = sdf.parse(str); java.sql.Date date7 = new java.sql.Date(date6.getTime()); return date7.toString(); } catch (ParseException e) { e.printStackTrace(); ... |
String | changeStringToDate3(String str) change String To Date SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date date6 = null; try { date6 = sdf.parse(str); java.sql.Date date7 = new java.sql.Date(date6.getTime()); Timestamp stamp9 = new Timestamp(date7.getTime()); return stamp9.toString(); } catch (ParseException e) { ... |