public class DateUtils
extends java.lang.Object
Note that this class doesn't use static methods because of the synchronization issues with SimpleDateFormat. This lets synchronization be done on a per-object level, instead of on a per-class level.
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.text.SimpleDateFormat |
alternateIso8601DateFormat
Alternate ISO 8601 format without fractional seconds
|
protected java.text.SimpleDateFormat |
compressedIso8601DateFormat
This is another ISO 8601 format that's used in clock skew error response
|
protected java.text.SimpleDateFormat |
iso8601DateFormat
ISO 8601 format
|
protected java.text.SimpleDateFormat |
rfc822DateFormat
RFC 822 format
|
| コンストラクタと説明 |
|---|
DateUtils()
Constructs a new DateUtils object, ready to parse/format dates.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
java.lang.String |
formatIso8601Date(java.util.Date date)
Formats the specified date as an ISO 8601 string.
|
java.lang.String |
formatRfc822Date(java.util.Date date)
Formats the specified date as an RFC 822 string.
|
java.util.Date |
parseCompressedIso8601Date(java.lang.String dateString)
Parses the specified date string as a compressedIso8601DateFormat ("yyyyMMdd'T'HHmmss'Z'") and returns the Date
object.
|
java.util.Date |
parseIso8601Date(java.lang.String dateString)
Parses the specified date string as an ISO 8601 date and returns the Date
object.
|
java.util.Date |
parseRfc822Date(java.lang.String dateString)
Parses the specified date string as an RFC 822 date and returns the Date
object.
|
protected final java.text.SimpleDateFormat iso8601DateFormat
protected final java.text.SimpleDateFormat alternateIso8601DateFormat
protected final java.text.SimpleDateFormat rfc822DateFormat
protected final java.text.SimpleDateFormat compressedIso8601DateFormat
public DateUtils()
public java.util.Date parseIso8601Date(java.lang.String dateString)
throws java.text.ParseException
dateString - The date string to parse.java.text.ParseException - If the date string could not be parsed.public java.lang.String formatIso8601Date(java.util.Date date)
date - The date to format.public java.util.Date parseRfc822Date(java.lang.String dateString)
throws java.text.ParseException
dateString - The date string to parse.java.text.ParseException - If the date string could not be parsed.public java.lang.String formatRfc822Date(java.util.Date date)
date - The date to format.public java.util.Date parseCompressedIso8601Date(java.lang.String dateString)
throws java.text.ParseException
dateString - The date string to parse.java.text.ParseException - If the date string could not be parsed.