List of utility methods to do Hour Format
String | formatOptimal(Date d) Formats a Date to a String, leaving out trailing zero values. String result; if ((d.getTime() % 1000) == 0) { if (d.getSeconds() == 0) { if (d.getMinutes() == 0 && d.getHours() == 0) { result = format(d, "yyyy-MM-dd"); } else { result = format(d, "yyyy-MM-dd HH:mm"); } else { result = format(d, "yyyy-MM-dd HH:mm:ss"); } else { result = format(d, "yyyy-MM-dd HH:mm:ss.SSS"); return result; |
String | formatPrice(double price, String style) format Price NumberFormat nf = new DecimalFormat(style); return nf.format(price); |
String | formatRawDateTime(int unixtime) format Raw Date Time return DATE_TIME_FORMAT.format(new Date(unixtime * 1000L)); |
String | formatRecyclingDate(String strDate) format Recycling Date try { SimpleDateFormat input = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); if (strDate.trim().isEmpty()) return blankField; else { Date dt = input.parse(strDate); SimpleDateFormat output = new SimpleDateFormat("MM/dd/yy HH:mm"); if (dt != null) ... |
String | formatRFC1123(Date date) Formats the given Date to a string in RFC1123 format. SimpleDateFormat sdf = new SimpleDateFormat(PATTERN_RFC1123_DATE, Locale.US); sdf.setTimeZone(TIMEZONE_GMT); return sdf.format(date); |
String | formatRfc3339Date(Date date) format Rfc Date return formatRfc3339Date(date, null);
|
String | formatRFC822(Date date) format RFC return rfc822DateFormat.format(date);
|
String | formatRFC822(Date date, Locale locale) format RFC SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", locale); dateFormater.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormater.format(date); |
String | formatRFC822(Date date, String timezone) Format given date as an RFC822 formatted date/time String. SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); if (timezone != null) { dateFormat.setTimeZone(TimeZone.getTimeZone(timezone)); String dateString = null; if (date != null) { dateString = dateFormat.format(date); return dateString; |
String | formatRfc822Date(Date date) format Rfc Date synchronized (rfc822DateParser) { return rfc822DateParser.format(date); |