List of utility methods to do Date String Format
String | formatDate(String date) format Date date = date.substring(0, 19);
return date;
|
String | formatDate(String date) format Date int i = date.indexOf(";"); String[] tokens = date.substring(0, i).split("[ -/]"); if (tokens.length == 1) return tokens[0]; if (tokens.length == 2) return tokens[0] + "-" + tokens[1]; return tokens[0] + "-" + tokens[1] + "-" + tokens[2]; |
String | formatDate(String date) format Date String y = date.substring(0, 4); String m = date.substring(4, 6); String d = date.substring(6, 8); return y + "-" + m + "-" + d; |
String | formatDate(String date, int format) Reads a particular date format then translates it to another format. String retVal = null; if (date == null || date.length() == 0) return "unknown"; String[] strs = date.split("-"); if (strs.length != 3) return "unknown"; int month = Integer.parseInt(strs[0]); int day = Integer.parseInt(strs[1]); ... |
String | formatDate(String dateString, String delimiter) format Date if (dateString == null) return ""; String output = dateString.replaceAll("[^0-9]", ""); if (output.length() == 8) { return (output.substring(0, 4) + delimiter + output.substring(4, 6) + delimiter + output.substring(6, 8)); } else if (output.length() == 6) { return (output.substring(0, 4) + delimiter + output.substring(4, 6)); ... |
String | formatDate(String fieldName) format Date return String.format( "(trim(str(year(%1$s))) " + "|| '-' || (case when month(%1$s) < 10 then '0' else '' end) || trim(str(month(%1$s))) " + "|| '-' || (case when day(%1$s) < 10 then '0' else '' end) || trim(str(day(%1$s))))", fieldName); |
String | FormatDate(String strDate, char DateSeparator) Format Date String strOutDate; int Len; Len = strDate.length(); if ((Len != 6) && (Len != 8)) strOutDate = strDate; else { if (Len == 6) { strDate = strDate.substring(0, 2) + DateSeparator + strDate.substring(2, 4) + DateSeparator ... |
String | formatDate(String unformattedDate, String format) format Date String[] splitUFDate = unformattedDate.split("-"); if (splitUFDate.length != 6) return ""; String formattedDate = format; String[] patterns = { "Y", "M", "D", "h", "m", "s" }; int l = Math.min(patterns.length, splitUFDate.length); for (int i = 0; i < l; ++i) formattedDate = formattedDate.replaceAll(patterns[i], splitUFDate[i]); ... |
String | formatDate(String values) format Date String[] dateParts = values.split("\\."); String newDate = dateParts[2] + "-" + dateParts[1] + "-" + dateParts[0]; return newDate; |
String | FormatDate6(String strDate) Format Date if (strDate == null) { return ""; strDate = strDate.trim(); if (strDate.length() < 6) { return ""; else { ... |