public class DateUtils extends 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.
| 构造器和说明 |
|---|
DateUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
formatAlternateIso8601Date(Date date)
Formats the specified date as an ISO 8601 string.
|
static String |
formatCompressedIso8601Date(Date date)
Returns a string representation of the given date time in yyyyMMdd
format.
|
static String |
formatCompressedIso8601Date(org.joda.time.LocalDate date)
Returns a string representation of the given date time in yyyyMMdd
format.
|
static String |
formatCompressedIso8601DateTime(Date date)
Returns a string representation of the given date time in
yyyyMMdd'T'HHmmss'Z' format.
|
static String |
formatCompressedIso8601DateTime(org.joda.time.DateTime dateTime)
Returns a string representation of the given date time in
yyyyMMdd'T'HHmmss'Z' format.
|
static String |
formatIso8601Date(Date date)
Formats the specified date as an ISO 8601 string.
|
static String |
formatRfc822Date(Date date)
Formats the specified date as an RFC 822 string.
|
static String |
formatSimpleDate(org.joda.time.LocalDate date) |
static String |
formatSimpleDateTime(org.joda.time.DateTime dateTime) |
static Date |
parseAlternateIso8601Date(String dateString)
Parses the specified date string as an ISO 8601 date and returns the Date object.
|
static Date |
parseCompressedIso8601Date(String dateString)
Parses the specified date string as a compressedIso8601DateTimeFormat ("yyyyMMdd'T'HHmmss'Z'") and returns the Date
object.
|
static Date |
parseIso8601Date(String dateString)
Parses the specified date string as an ISO 8601 date and returns the Date object.
|
static Date |
parseRfc822Date(String dateString)
Parses the specified date string as an RFC 822 date and returns the Date object.
|
static org.joda.time.DateTime |
parseSimpleDate(String dateString) |
static org.joda.time.DateTime |
parseSimpleDateTime(String dateTimeString) |
public static Date parseIso8601Date(String dateString)
dateString - The date string to parse.IllegalArgumentException - If the date string could not be parsed.public static String formatIso8601Date(Date date)
date - The date to format.public static Date parseAlternateIso8601Date(String dateString)
dateString - The date string to parse.IllegalArgumentException - If the date string could not be parsed.public static String formatAlternateIso8601Date(Date date)
date - The date to format.public static Date parseRfc822Date(String dateString)
dateString - The date string to parse.IllegalArgumentException - If the date string could not be parsed.public static String formatRfc822Date(Date date)
date - The date to format.public static Date parseCompressedIso8601Date(String dateString)
dateString - The date string to parse.IllegalArgumentException - If the date string could not be parsed.public static String formatCompressedIso8601Date(Date date)
For example, given a time "1416863450581", this method returns "20141124"
public static String formatCompressedIso8601Date(org.joda.time.LocalDate date)
For example, given a time "1416863450581", this method returns "20141124"
public static String formatCompressedIso8601DateTime(Date date)
For example, given a time "1416863450581", this method returns "20141124T211050Z"
public static String formatCompressedIso8601DateTime(org.joda.time.DateTime dateTime)
For example, given a time "1416863450581", this method returns "20141124T211050Z"
public static String formatSimpleDateTime(org.joda.time.DateTime dateTime)
public static org.joda.time.DateTime parseSimpleDateTime(String dateTimeString)
public static String formatSimpleDate(org.joda.time.LocalDate date)
public static org.joda.time.DateTime parseSimpleDate(String dateString)
Copyright © 2024. All rights reserved.