/** * Converts the specified Date object to an RFC 3339 date/time string using * the specified time zone. * * @param date * the Date object * @param zone * the time zone to use * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String toString(Date date, TimeZone zone) { InternetDateFormat dt = new InternetDateFormat(date, zone); return dt.toString(); }
/** * Returns the current date and time as an RFC 3339 date/time string using * the UTC (Z) time zone. * * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String now() { return now(UTC); }
@Override public Date parse(String source) throws ParseException { return parse(source, (ParsePosition) null); }
/** * Creates a new InternetDateFormat object from the specified millisecond * time value using the UTC (Z) time zone. * * @param time * the millisecond time value * @return the InternetDateFormat object */ public static InternetDateFormat valueOf(long time) { return new InternetDateFormat(time); }
/** * Converts the specified Date object to an RFC 3339 date/time string using * the UTC (Z) time zone. * * @param date * the Date object * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String toString(Date date) { return toString(date, UTC); }
@Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { return toAppendTo.append(valueOf(date)); }
/** * Creates a new InternetDateFormat object by parsing an RFC 3339 date/time * string. * * @param s * the string to parse * @throws IllegalArgumentException * if the string is not a valid RFC 3339 date/time string */ public InternetDateFormat(String s) { cal = parseCalendar(s); }
@Override public Date parse(String source, ParsePosition pos) { return parseDate(source); }
/** * Creates a new InternetDateFormat object from the specified millisecond * time value using the UTC (Z) time zone. * * @param time * the millisecond time value * @return the InternetDateFormat object */ public static InternetDateFormat valueOf(long time) { return new InternetDateFormat(time); }
/** * Converts this InternetDateFormat object to an RFC 3339 date/time string. * * @return an RFC 3339 date/time string (does not include milliseconds) */ public String toString() { return toString(cal); } }
@Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { return toAppendTo.append(valueOf(date)); }
/** * Creates a new InternetDateFormat object by parsing an RFC 3339 date/time * string. * * @param s * the string to parse * @throws IllegalArgumentException * if the string is not a valid RFC 3339 date/time string */ public InternetDateFormat(String s) { cal = parseCalendar(s); }
@Override public Date parse(String source, ParsePosition pos) { return parseDate(source); }
/** * Converts the specified millisecond time value to an RFC 3339 date/time * string using the specified time zone. * * @param time * the millisecond time value * @param zone * the time zone to use * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String toString(long time, TimeZone zone) { InternetDateFormat dt = new InternetDateFormat(time, zone); return dt.toString(); }
/** * Creates a new InternetDateFormat object from the specified Date object * using the UTC (Z) time zone. * * @param date * the Date object * @return the InternetDateFormat object */ public static InternetDateFormat valueOf(Date date) { return new InternetDateFormat(date); }
/** * Converts the specified Date object to an RFC 3339 date/time string using * the UTC (Z) time zone. * * @param date * the Date object * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String toString(Date date) { return toString(date, UTC); }
@Override public Date parse(String source) throws ParseException { return parse(source, (ParsePosition) null); }
/** * Returns the current date and time as an RFC 3339 date/time string using * the UTC (Z) time zone. * * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String now() { return now(UTC); }
/** * Converts the specified Date object to an RFC 3339 date/time string using * the specified time zone. * * @param date * the Date object * @param zone * the time zone to use * @return an RFC 3339 date/time string (does not include milliseconds) */ public static String toString(Date date, TimeZone zone) { InternetDateFormat dt = new InternetDateFormat(date, zone); return dt.toString(); }
/** * Creates a new InternetDateFormat object from the specified Date object * using the UTC (Z) time zone. * * @param date * the Date object * @return the InternetDateFormat object */ public static InternetDateFormat valueOf(Date date) { return new InternetDateFormat(date); }