List of utility methods to do Date Format Change
String | convertIso8601FormatToArsTimeOfDay(String timeOfDayString) Converts a string in ISO8601 Format into the string corresponding to an Ars internal time of day representation int hours, minutes, seconds; int total = 0; try { hours = Integer.parseInt(timeOfDayString.substring(0, 2)); } catch (NumberFormatException e) { throw new ParseException("Unparseable dime: " + timeOfDayString, 0); try { ... |
Calendar | convertISO8610ToCalendar(String iso8601string) Convert an ISO8601 UTC string to a Calendar object. Calendar calendar = GregorianCalendar.getInstance(); String s = iso8601string.replace("Z", "+00:00"); try { s = s.substring(0, 22) + s.substring(23); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = formatter.parse(s); calendar.setTime(date); ... |
long | convertTimeStringToTimestamp(String timeString, String timeFormat) convert Time String To Timestamp SimpleDateFormat sdf = new SimpleDateFormat(timeFormat); return sdf.parse(timeString).getTime(); |