public final class DateUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static TimeZone |
GMT |
static String |
PATTERN_ASCTIME
用于解析ANSI C
asctime()格式的HTTP日期标头的日期格式模式。
|
static String |
PATTERN_RFC1036
用于解析RFC 1036格式的HTTP日期标头的日期格式模式。
|
static String |
PATTERN_RFC1123
用于解析RFC 1123格式的HTTP日期标头的日期格式模式。
|
| Modifier and Type | Method and Description |
|---|---|
static void |
clearThreadLocal()
清除线程局部变量,包含 DateFormat缓存。
|
static String |
formatDate(Date date)
根据RFC 1123模式格式化给定的日期。
|
static String |
formatDate(Date date, String pattern)
根据指定的格式格式给定日期。
|
static Date |
parseDate(String dateValue)
解析日期值。
|
static Date |
parseDate(String dateValue, String[] dateFormats)
使用给定的日期格式解析日期值。
|
static Date |
parseDate(String dateValue, String[] dateFormats, Date startDate)
使用给定的日期格式解析日期值。
|
public static final String PATTERN_RFC1123
public static final String PATTERN_RFC1036
public static final String PATTERN_ASCTIME
asctime()格式的HTTP日期标头的日期格式模式。
public static final TimeZone GMT
public static Date parseDate(String dateValue)
dateValue - 要解析的日期值
public static Date parseDate(String dateValue, String[] dateFormats)
dateValue - 要解析的日期值
dateFormats - 要使用的日期格式
public static Date parseDate(String dateValue, String[] dateFormats, Date startDate)
dateValue - 要解析的日期值
dateFormats - 要使用的日期格式
startDate - 在解析期间,两位数年份将被放置在startDate到startDate + 100 years的范围内。
该值可能为null 。
当null被作为参数,一年2000将被使用。
public static String formatDate(Date date)
date - 格式化日期。
PATTERN_RFC1123
public static String formatDate(Date date, String pattern)
simple date format类使用的模式 。
date - 格式化日期。
pattern - 用于格式化日期的模式。
IllegalArgumentException - 如果给定的日期模式无效。
SimpleDateFormat
public static void clearThreadLocal()
DateFormat缓存。
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.