List of utility methods to do Time Format
String | getTimeStr(long time) get Time Str return dateFormater.format(new Date(time)); |
String | getTimeString(Date utcDate) get Time String if (utcDate.getTime() == 0) { return ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA); return sdf.format(utcDate.getTime()); |
String | getTimeString(String dateString) get user friendly data string, a combination of getCalenderFromDateString and getUserFriendlyTime return getUserFriendlyTime(getCalenderFromDateString(dateString));
|
String | getTimeString(String utcTimeString) get Time String try { SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = sdf.parse(utcTimeString); sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); return sdf.format(date.getTime()); } catch (ParseException e) { ... |
String | dateTimeToXSDate(Date date) * Convert DateTime to XML Schema date. String format = "yyyy-MM-dd'Z'"; DateFormat utcFormatter = new SimpleDateFormat(format); return utcFormatter.format(date); |
String | dateTimeToXSDateTime(Date date) * Dates the DateTime into an XML schema date time. String format = "yyyy-MM-dd'T'HH:mm:ss'Z'"; DateFormat utcFormatter = new SimpleDateFormat(format); return utcFormatter.format(date); |