Enum FixedDateFormat.FixedFormat
- java.lang.Object
-
- java.lang.Enum<FixedDateFormat.FixedFormat>
-
- org.apache.logging.log4j.core.util.datetime.FixedDateFormat.FixedFormat
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<FixedDateFormat.FixedFormat>
- Enclosing class:
- FixedDateFormat
public static enum FixedDateFormat.FixedFormat extends java.lang.Enum<FixedDateFormat.FixedFormat>
Enumeration over the supported date/time format patterns.Package protected for unit tests.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ABSOLUTEABSOLUTE time format:"HH:mm:ss,SSS".ABSOLUTE_MICROSABSOLUTE time format with microsecond precision:"HH:mm:ss,nnnnnn".ABSOLUTE_NANOSABSOLUTE time format with nanosecond precision:"HH:mm:ss,nnnnnnnnn".ABSOLUTE_PERIODABSOLUTE time format variation with period separator:"HH:mm:ss.SSS".COMPACTCOMPACT time format:"yyyyMMddHHmmssSSS".DATEDATE_AND_TIME time format:"dd MMM yyyy HH:mm:ss,SSS".DATE_PERIODDATE_AND_TIME time format variation with period separator:"dd MMM yyyy HH:mm:ss.SSS".DEFAULTDEFAULT time format:"yyyy-MM-dd HH:mm:ss,SSS".DEFAULT_MICROSDEFAULT time format with microsecond precision:"yyyy-MM-dd HH:mm:ss,nnnnnn".DEFAULT_NANOSDEFAULT time format with nanosecond precision:"yyyy-MM-dd HH:mm:ss,nnnnnnnnn".DEFAULT_PERIODDEFAULT time format variation with period separator:"yyyy-MM-dd HH:mm:ss.SSS".ISO8601ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSS".ISO8601_BASICISO8601_BASIC time format:"yyyyMMdd'T'HHmmss,SSS".ISO8601_BASIC_PERIODISO8601_BASIC time format:"yyyyMMdd'T'HHmmss.SSS".ISO8601_OFFSET_DATE_TIME_HHISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSX"with a time zone like-07.ISO8601_OFFSET_DATE_TIME_HHCMMISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSXXX"with a time zone like-07:00.ISO8601_OFFSET_DATE_TIME_HHMMISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSXX"with a time zone like-0700.ISO8601_PERIODISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss.SSS".ISO8601_PERIOD_MICROSISO8601 time format with support for microsecond precision:"yyyy-MM-dd'T'HH:mm:ss.nnnnnn".US_MONTH_DAY_YEAR2_TIMEAmerican date/time format with 2-digit year:"dd/MM/yy HH:mm:ss.SSS".US_MONTH_DAY_YEAR4_TIMEAmerican date/time format with 4-digit year:"dd/MM/yyyy HH:mm:ss.SSS".
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdatePatternprivate static java.lang.StringDEFAULT_SECOND_FRACTION_PATTERNprivate static int[]EMPTY_RANGEprivate intescapeCountprivate FixedDateFormat.FixedTimeZoneFormatfixedTimeZoneFormatprivate static intMILLI_FRACTION_DIGITSprivate charmillisSeparatorCharprivate intmillisSeparatorLengthprivate java.lang.Stringpatternprivate static charSECOND_FRACTION_PATTERNprivate intsecondFractionDigitsprivate chartimeSeparatorCharprivate inttimeSeparatorLength
-
Constructor Summary
Constructors Modifier Constructor Description privateFixedFormat(java.lang.String pattern, java.lang.String datePattern, int escapeCount, char timeSeparator, int timeSepLength, char millisSeparator, int millisSepLength, int secondFractionDigits, FixedDateFormat.FixedTimeZoneFormat timeZoneFormat)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDatePattern()Returns the date part of the pattern.intgetDatePatternLength()Returns the length of the date part of the resulting formatted string.FastDateFormatgetFastDateFormat()Returns theFastDateFormatobject for formatting the date part of the pattern ornullif the pattern does not have a date part.FastDateFormatgetFastDateFormat(java.util.TimeZone tz)Returns theFastDateFormatobject for formatting the date part of the pattern ornullif the pattern does not have a date part.FixedDateFormat.FixedTimeZoneFormatgetFixedTimeZoneFormat()Returns the optional time zone format.intgetLength()Returns the length of the resulting formatted date and time strings.java.lang.StringgetPattern()Returns the full pattern.intgetSecondFractionDigits()Returns the number of digits specifying the fraction of the second to showstatic FixedDateFormat.FixedFormatlookup(java.lang.String nameOrPattern)Returns the FixedFormat with the name or pattern matching the specified string ornullif not found.(package private) static FixedDateFormat.FixedFormatlookupIgnoringNanos(java.lang.String pattern)private static int[]nanoRange(java.lang.String pattern)static FixedDateFormat.FixedFormatvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static FixedDateFormat.FixedFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ABSOLUTE
public static final FixedDateFormat.FixedFormat ABSOLUTE
ABSOLUTE time format:"HH:mm:ss,SSS".
-
ABSOLUTE_MICROS
public static final FixedDateFormat.FixedFormat ABSOLUTE_MICROS
ABSOLUTE time format with microsecond precision:"HH:mm:ss,nnnnnn".
-
ABSOLUTE_NANOS
public static final FixedDateFormat.FixedFormat ABSOLUTE_NANOS
ABSOLUTE time format with nanosecond precision:"HH:mm:ss,nnnnnnnnn".
-
ABSOLUTE_PERIOD
public static final FixedDateFormat.FixedFormat ABSOLUTE_PERIOD
ABSOLUTE time format variation with period separator:"HH:mm:ss.SSS".
-
COMPACT
public static final FixedDateFormat.FixedFormat COMPACT
COMPACT time format:"yyyyMMddHHmmssSSS".
-
DATE
public static final FixedDateFormat.FixedFormat DATE
DATE_AND_TIME time format:"dd MMM yyyy HH:mm:ss,SSS".
-
DATE_PERIOD
public static final FixedDateFormat.FixedFormat DATE_PERIOD
DATE_AND_TIME time format variation with period separator:"dd MMM yyyy HH:mm:ss.SSS".
-
DEFAULT
public static final FixedDateFormat.FixedFormat DEFAULT
DEFAULT time format:"yyyy-MM-dd HH:mm:ss,SSS".
-
DEFAULT_MICROS
public static final FixedDateFormat.FixedFormat DEFAULT_MICROS
DEFAULT time format with microsecond precision:"yyyy-MM-dd HH:mm:ss,nnnnnn".
-
DEFAULT_NANOS
public static final FixedDateFormat.FixedFormat DEFAULT_NANOS
DEFAULT time format with nanosecond precision:"yyyy-MM-dd HH:mm:ss,nnnnnnnnn".
-
DEFAULT_PERIOD
public static final FixedDateFormat.FixedFormat DEFAULT_PERIOD
DEFAULT time format variation with period separator:"yyyy-MM-dd HH:mm:ss.SSS".
-
ISO8601_BASIC
public static final FixedDateFormat.FixedFormat ISO8601_BASIC
ISO8601_BASIC time format:"yyyyMMdd'T'HHmmss,SSS".
-
ISO8601_BASIC_PERIOD
public static final FixedDateFormat.FixedFormat ISO8601_BASIC_PERIOD
ISO8601_BASIC time format:"yyyyMMdd'T'HHmmss.SSS".
-
ISO8601
public static final FixedDateFormat.FixedFormat ISO8601
ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSS".
-
ISO8601_OFFSET_DATE_TIME_HH
public static final FixedDateFormat.FixedFormat ISO8601_OFFSET_DATE_TIME_HH
ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSX"with a time zone like-07.
-
ISO8601_OFFSET_DATE_TIME_HHMM
public static final FixedDateFormat.FixedFormat ISO8601_OFFSET_DATE_TIME_HHMM
ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSXX"with a time zone like-0700.
-
ISO8601_OFFSET_DATE_TIME_HHCMM
public static final FixedDateFormat.FixedFormat ISO8601_OFFSET_DATE_TIME_HHCMM
ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss,SSSXXX"with a time zone like-07:00.
-
ISO8601_PERIOD
public static final FixedDateFormat.FixedFormat ISO8601_PERIOD
ISO8601 time format:"yyyy-MM-dd'T'HH:mm:ss.SSS".
-
ISO8601_PERIOD_MICROS
public static final FixedDateFormat.FixedFormat ISO8601_PERIOD_MICROS
ISO8601 time format with support for microsecond precision:"yyyy-MM-dd'T'HH:mm:ss.nnnnnn".
-
US_MONTH_DAY_YEAR2_TIME
public static final FixedDateFormat.FixedFormat US_MONTH_DAY_YEAR2_TIME
American date/time format with 2-digit year:"dd/MM/yy HH:mm:ss.SSS".
-
US_MONTH_DAY_YEAR4_TIME
public static final FixedDateFormat.FixedFormat US_MONTH_DAY_YEAR4_TIME
American date/time format with 4-digit year:"dd/MM/yyyy HH:mm:ss.SSS".
-
-
Field Detail
-
DEFAULT_SECOND_FRACTION_PATTERN
private static final java.lang.String DEFAULT_SECOND_FRACTION_PATTERN
- See Also:
- Constant Field Values
-
MILLI_FRACTION_DIGITS
private static final int MILLI_FRACTION_DIGITS
-
SECOND_FRACTION_PATTERN
private static final char SECOND_FRACTION_PATTERN
- See Also:
- Constant Field Values
-
pattern
private final java.lang.String pattern
-
datePattern
private final java.lang.String datePattern
-
escapeCount
private final int escapeCount
-
timeSeparatorChar
private final char timeSeparatorChar
-
timeSeparatorLength
private final int timeSeparatorLength
-
millisSeparatorChar
private final char millisSeparatorChar
-
millisSeparatorLength
private final int millisSeparatorLength
-
secondFractionDigits
private final int secondFractionDigits
-
fixedTimeZoneFormat
private final FixedDateFormat.FixedTimeZoneFormat fixedTimeZoneFormat
-
EMPTY_RANGE
private static final int[] EMPTY_RANGE
-
-
Constructor Detail
-
FixedFormat
private FixedFormat(java.lang.String pattern, java.lang.String datePattern, int escapeCount, char timeSeparator, int timeSepLength, char millisSeparator, int millisSepLength, int secondFractionDigits, FixedDateFormat.FixedTimeZoneFormat timeZoneFormat)
-
-
Method Detail
-
values
public static FixedDateFormat.FixedFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FixedDateFormat.FixedFormat c : FixedDateFormat.FixedFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FixedDateFormat.FixedFormat valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getPattern
public java.lang.String getPattern()
Returns the full pattern.- Returns:
- the full pattern
-
getDatePattern
public java.lang.String getDatePattern()
Returns the date part of the pattern.- Returns:
- the date part of the pattern
-
lookup
public static FixedDateFormat.FixedFormat lookup(java.lang.String nameOrPattern)
Returns the FixedFormat with the name or pattern matching the specified string ornullif not found.- Parameters:
nameOrPattern- the name or pattern to find a FixedFormat for- Returns:
- the FixedFormat with the name or pattern matching the specified string
-
lookupIgnoringNanos
static FixedDateFormat.FixedFormat lookupIgnoringNanos(java.lang.String pattern)
-
nanoRange
private static int[] nanoRange(java.lang.String pattern)
- Returns:
- int[0] start index inclusive; int[1] end index exclusive
-
getLength
public int getLength()
Returns the length of the resulting formatted date and time strings.- Returns:
- the length of the resulting formatted date and time strings
-
getDatePatternLength
public int getDatePatternLength()
Returns the length of the date part of the resulting formatted string.- Returns:
- the length of the date part of the resulting formatted string
-
getFastDateFormat
public FastDateFormat getFastDateFormat()
Returns theFastDateFormatobject for formatting the date part of the pattern ornullif the pattern does not have a date part.- Returns:
- the
FastDateFormatobject for formatting the date part of the pattern ornull
-
getFastDateFormat
public FastDateFormat getFastDateFormat(java.util.TimeZone tz)
Returns theFastDateFormatobject for formatting the date part of the pattern ornullif the pattern does not have a date part.- Parameters:
tz- the time zone to use- Returns:
- the
FastDateFormatobject for formatting the date part of the pattern ornull
-
getSecondFractionDigits
public int getSecondFractionDigits()
Returns the number of digits specifying the fraction of the second to show- Returns:
- 3 for millisecond precision, 6 for microsecond precision or 9 for nanosecond precision
-
getFixedTimeZoneFormat
public FixedDateFormat.FixedTimeZoneFormat getFixedTimeZoneFormat()
Returns the optional time zone format.- Returns:
- the optional time zone format, may be null.
-
-