public class DateTimeFormatting extends Object
SimpleDateFormat
. Most specifiers compatible with the JDK will
be compatible with Joda time, the notable exceptions being:
Additional properties related to the parsing of values are also provided:
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PIVOT
The default pivot year used for two-digit year values,
2000 . |
Constructor and Description |
---|
DateTimeFormatting(String pattern)
Defines a format using the specified pattern.
|
DateTimeFormatting(String pattern,
boolean lenient)
Defines a format using the specified pattern and parsing leniency.
|
DateTimeFormatting(String pattern,
int pivotYear)
Defines a format using the specified pattern and pivot year.
|
Modifier and Type | Method and Description |
---|---|
String |
getPattern()
Gets the format pattern used for parsing and formatting date/time values.
|
int |
getPivotYear()
Gets the year defining the midpoint of the 100-year
period assumed for two-digit year values.
|
boolean |
isLenient()
Indicates whether parsing is to be lenient with respect to well-formed
but invalid values.
|
void |
setLenient(boolean lenient)
Specifies whether parsing of values should be lenient.
|
void |
setPattern(String pattern)
Specifies the format pattern to use when parsing or formatting date/time values.
|
void |
setPivotYear(int year)
Specifies the midpoint of the 100-year period for two-digit
dates.
|
public static final int DEFAULT_PIVOT
2000
.public DateTimeFormatting(String pattern)
pattern
- the text format to usepublic DateTimeFormatting(String pattern, boolean lenient)
pattern
- the text format to uselenient
- indicates whether parsing should be lenient.public DateTimeFormatting(String pattern, int pivotYear)
pattern
- the text format to usepivotYear
- the year in the middle of the 100-year period
used by two-digit year valuespublic void setPattern(String pattern)
pattern
- the format pattern to usepublic String getPattern()
public void setLenient(boolean lenient)
lenient
- indicates whether parsing should be lenient.public boolean isLenient()
public void setPivotYear(int year)
year-50
and year+49
.year
- the midpoint of the range for parsed year valuespublic int getPivotYear()
Copyright © 2021 Actian Corporation. All rights reserved.