public enum DateUnit extends Enum<DateUnit>
Enum Constant and Description |
---|
DAY
一天的毫秒数
|
HOUR
一小时的毫秒数
|
MINUTE
一分钟的毫秒数
|
MS
一毫秒
|
SECOND
一秒的毫秒数
|
WEEK
一周的毫秒数
|
Modifier and Type | Method and Description |
---|---|
long |
getMillis() |
static DateUnit |
of(ChronoUnit unit)
单位兼容转换,将
ChronoUnit 转换为对应的DateUnit |
ChronoUnit |
toChronoUnit()
单位兼容转换,将DateUnit转换为对应的
ChronoUnit |
static ChronoUnit |
toChronoUnit(DateUnit unit)
单位兼容转换,将DateUnit转换为对应的
ChronoUnit |
static DateUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DateUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DateUnit MS
public static final DateUnit SECOND
public static final DateUnit MINUTE
public static final DateUnit HOUR
public static final DateUnit DAY
public static final DateUnit WEEK
public static DateUnit[] values()
for (DateUnit c : DateUnit.values()) System.out.println(c);
public static DateUnit 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 long getMillis()
public ChronoUnit toChronoUnit()
ChronoUnit
ChronoUnit
public static DateUnit of(ChronoUnit unit)
ChronoUnit
转换为对应的DateUnitunit
- ChronoUnit
public static ChronoUnit toChronoUnit(DateUnit unit)
ChronoUnit
unit
- DateUnitChronoUnit
Copyright © 2024. All rights reserved.