List of utility methods to do String to Date
String | longToDateString(long l) long To Date String Calendar c = Calendar.getInstance(); c.setTimeInMillis(l); Date d = (Date) c.getTime(); SimpleDateFormat format = new SimpleDateFormat("MMM-dd-yyyy"); String time = format.format(d); return time; |
String | longToDateStringDefault(long time) long To Date String Default return getFormatTimeString(new Date(time), "yyyyMMddHHmmss"); |
Date | numberToDate(String dateString) number To Date if ("".equals(dateString) || dateString == null) { return null; Date date = null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { ... |
Date | putTimeStr14ToDate(String dateTimeStr) put Time Str To Date Date date = null; try { switch (dateTimeStr.length()) { case 12: date = yyyyMMddmmss.parse(dateTimeStr); break; case 13: ; ... |
Date | putTimeStr19ToDate(String dateTimeStr19) put Time Str To Date Date date = null; try { date = dfyyyyMMddHHMMSS.parse(dateTimeStr19); } catch (ParseException e) { e.printStackTrace(); return date; |
Date | rfc3339ToDate(String s) Convert an RFC 3309 String to a Date. s = s.toUpperCase();
Date ret = theRfc3339Format.parse(s);
return ret;
|
Date | SortStringToDate(String thisdate, Locale locale) Sort String To Date return StringToDate(reformatDateString(thisdate), locale);
|
Date | strChangeToDate(String str) str Change To Date Date date = null; try { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS"); date = sd.parse(str); } catch (Exception e) { e.printStackTrace(); return date; ... |
Date | strDateConvertToDate(String strDate, String fFormatStr) str Date Convert To Date java.util.Date birthday = new java.util.Date(); java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fFormatStr); try { birthday = sdf.parse(strDate); return birthday; } catch (ParseException e) { e.printStackTrace(); return null; ... |
Date[] | stringArrayTODateArray(String[] dates_s, SimpleDateFormat dateformat) string Array TO Date Array if (dates_s == null) { return null; Date[] dates = new Date[dates_s.length]; for (int i = 0; i < dates_s.length; i++) { if (dateformat != null) { try { dates[i] = dateformat.parse((dates_s[i])); ... |