List of utility methods to do HTTP Date
String | getHttpDate() get Http Date return getHttpDate(new Date()); |
String | gethttpDate() Generate an rfc822 date for use in the Date HTTP header. final String DateFormat = "EEE, dd MMM yyyy HH:mm:ss "; SimpleDateFormat format = new SimpleDateFormat(DateFormat, Locale.US); format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.format(new Date()) + "GMT"; |
String | getHTTPDate() get the date according to the HTTP standard DateFormat httpDateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.ENGLISH); httpDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return httpDateFormat.format(new Date()); |
String | getHttpDate() convienence method returns current timestamp return getHttpDate(new Date()); |
String | getHttpDate(int days) Format a date string in http-date format (Thu, 01 Dec 1994 16:00:00 GMT) Calendar calendar = Calendar.getInstance(); long time = calendar.getTimeInMillis(); time += days * 24 * 60 * 60 * 1000L; calendar.setTimeInMillis(time); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); String ret = dateFormat.format(calendar.getTime()); return ret; ... |
String | getHttpDate(long l) get Http Date return getDateString(l, "EEE, d MMM yyyy HH:mm:ss") + " GMT"; |
long | getHttpDate(String date) Returns long representation of the HTTP defined RFC 1123 date format. SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); try { return dateFormat.parse(date).getTime(); } catch (Exception e) { return -1; |
Date | getHttpDate(String value) get Http Date if (value == null) { return null; Date result = null; try { result = getCxfHttpDateFormat().parse(value); } catch (ParseException ex) { try { ... |
SimpleDateFormat | getHttpDateFormat() get Http Date Format SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); TimeZone tZone = TimeZone.getTimeZone("GMT"); dateFormat.setTimeZone(tZone); return dateFormat; |
SimpleDateFormat | getHttpDateFormat(String dataFormat, Locale defaultLocale, String defaultTimeZone) Create a SimpleDateFormat instance given the specified template, locale, and time zone. SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, defaultLocale); TimeZone tZone = TimeZone.getTimeZone(defaultTimeZone); dateFormat.setTimeZone(tZone); dateFormat.setLenient(false); return dateFormat; |