List of utility methods to do Date to String
String | convertDateToURLFormat(final String dateToBeConvert) convert Date To URL Format final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy", Locale.US); final SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); String reformattedStr = ""; try { reformattedStr = newFormat.format(oldFormat.parse(dateToBeConvert)); } catch (final ParseException e) { e.printStackTrace(); return reformattedStr; |
String | convertStringoXSDString(Date date) convert Stringo XSD String if (date == null) { return null; StringBuilder lexicalForm; String dateTime = convertDateToString(date, false); int len = dateTime.length() - 1; if (dateTime.indexOf('.', len - 4) != -1) { while (dateTime.charAt(len - 1) == '0') { ... |
String | convertTimeToString(Date date, String pattern) convert Time To String SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(date); |
String | convertToString(Date date) convert To String SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { return formatter.format(date); } catch (Exception e) { return null; |
String | ConvertToString(Date date, String format) Converts a date object to a string using the specified format. SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); |
String | convertToString(Date date, String style) convert To String SimpleDateFormat df = new SimpleDateFormat(style); return df.format(date); |
String | convertToString(java.util.Date date) This method returns the string java.text.SimpleDateFormat out = new java.text.SimpleDateFormat("dd-MMM-yy"); return out.format(date); |
String | convertToString(String format, Date date) convert To String if (date == null) return ""; SimpleDateFormat df = new SimpleDateFormat(format); return df.format(date); |
String | date2str(Calendar c) datestr return new SimpleDateFormat(DATE_FORMAT).format(c.getTime()); |
String | date2Str(Calendar c, String format) date Str if (c == null) { return null; return date2Str(c.getTime(), format); |