public class DatePattern extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
DatePattern.NumberRule
Inner class defining a numeric rule.
|
static interface |
DatePattern.Rule
规则
|
| Constructor and Description |
|---|
DatePattern(String patternStr,
Locale locale,
TimeZone timeZone)
构造
|
| Modifier and Type | Method and Description |
|---|---|
<B extends Appendable> |
applyRules(Calendar calendar,
B buf)
根据指定格式,格式化日期时间
|
int |
getEstimateLength()
获取估算日期长度
|
protected static String |
parseToken(String pattern,
int[] indexRef)
Performs the parsing of tokens.
|
protected static DatePattern.NumberRule |
selectNumberRule(int field,
int padding)
Gets an appropriate rule for the padding required.
|
public int getEstimateLength()
public <B extends Appendable> B applyRules(Calendar calendar, B buf)
B - Appendable实现类, 一般为 StringBuilder 或 StringBuffer.calendar - Calendarbuf - 格式化后写出的Appendableprotected static String parseToken(String pattern, int[] indexRef)
Performs the parsing of tokens.
pattern - the patternindexRef - index referencesprotected static DatePattern.NumberRule selectNumberRule(int field, int padding)
Gets an appropriate rule for the padding required.
field - the field to get a rule forpadding - the padding requiredCopyright © 2025. All rights reserved.