public enum DateRangePrecision extends Enum<DateRangePrecision>
DateRangeBound
.Enum Constant and Description |
---|
DAY |
HOUR |
MILLISECOND |
MINUTE |
MONTH |
SECOND |
YEAR |
Modifier and Type | Method and Description |
---|---|
String |
format(ZonedDateTime timestamp)
Formats the given timestamp according to this precision.
|
static DateRangePrecision |
fromEncoding(byte encoding) |
byte |
getEncoding()
The code used to represent the precision when a date range is encoded to binary.
|
ZonedDateTime |
roundDown(ZonedDateTime timestamp)
Rounds down the given timestamp to this precision.
|
ZonedDateTime |
roundUp(ZonedDateTime timestamp)
Rounds up the given timestamp to this precision.
|
static DateRangePrecision |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DateRangePrecision[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DateRangePrecision MILLISECOND
public static final DateRangePrecision SECOND
public static final DateRangePrecision MINUTE
public static final DateRangePrecision HOUR
public static final DateRangePrecision DAY
public static final DateRangePrecision MONTH
public static final DateRangePrecision YEAR
public static DateRangePrecision[] values()
for (DateRangePrecision c : DateRangePrecision.values()) System.out.println(c);
public static DateRangePrecision valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static DateRangePrecision fromEncoding(byte encoding)
public byte getEncoding()
@NonNull public ZonedDateTime roundUp(@NonNull ZonedDateTime timestamp)
Temporal fields smaller than this precision will be rounded up; other fields will be left untouched.
@NonNull public ZonedDateTime roundDown(@NonNull ZonedDateTime timestamp)
Temporal fields smaller than this precision will be rounded down; other fields will be left untouched.
public String format(ZonedDateTime timestamp)
Copyright © 2017–2023. All rights reserved.