-
Field Summary
Modifier and TypeFieldDescriptionstatic final DateTimeFormatter
The ANSI C'sasctime()
format, such as'Sun Nov 6 08:49:37 1994'
.static final DateTimeFormatter
The RFC1123 date-time formatter, such as'Tue, 3 Jun 2008 11:05:30 GMT'
.static final DateTimeFormatter
The RFC850 date-time formatter, such as'Sunday, 06-Nov-94 08:49:37 GMT'
. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
Formatted date time terminated by carriage return and new line.static ZonedDateTime
Parse provided text toZonedDateTime
using any possible date / time format specified by RFC2616 Hypertext Transfer Protocol.static String
Get current time as RFC-1123 string.static ZonedDateTime
Last recorded timestamp.
-
Field Details
-
RFC_850_DATE_TIME
The RFC850 date-time formatter, such as'Sunday, 06-Nov-94 08:49:37 GMT'
.This is obsolete standard (obsoleted by RFC1036). Headers MUST NOT be generated in this format. However it should be used as a fallback for parsing to achieve compatibility with older HTTP standards.
Since the format accepts 2 digits year representation formatter works well for dates between
(now - 50 Years)
and(now + 49 Years)
. -
RFC_1123_DATE_TIME
The RFC1123 date-time formatter, such as'Tue, 3 Jun 2008 11:05:30 GMT'
.This is standard for RFC2616 and all created headers MUST be in this format! However implementation must accept headers also in RFC850 and ANSI C
asctime()
format.This is just copy of convenient copy of
DateTimeFormatter.RFC_1123_DATE_TIME
. -
ASCTIME_DATE_TIME
The ANSI C'sasctime()
format, such as'Sun Nov 6 08:49:37 1994'
.Headers MUST NOT be generated in this format. However it should be used as a fallback for parsing to achieve compatibility with older HTTP standards.
-
-
Method Details
-
parse
Parse provided text toZonedDateTime
using any possible date / time format specified by RFC2616 Hypertext Transfer Protocol.Formats are specified by
RFC_1123_DATE_TIME
,RFC_850_DATE_TIME
andASCTIME_DATE_TIME
.- Parameters:
text
- a text to parse.- Returns:
- parsed date time.
- Throws:
DateTimeParseException
- if not in any of supported formats.
-
timestamp
Last recorded timestamp.- Returns:
- timestamp
-
rfc1123String
Get current time as RFC-1123 string.- Returns:
- formatted current time
- See Also:
-
http1Bytes
public static byte[] http1Bytes()Formatted date time terminated by carriage return and new line.- Returns:
- date bytes for HTTP/1
-