mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -114,7 +114,9 @@ public class TemporalAccessorUtil extends TemporalUtil{
|
||||
|
||||
/**
|
||||
* {@link TemporalAccessor}转换为 时间戳(从1970-01-01T00:00:00Z开始的毫秒数)<br>
|
||||
* 如果为{@link Month},调用{@link Month#getValue()}
|
||||
* 如果为{@link Month},调用{@link Month#getValue()}<br>
|
||||
* 如果为{@link DayOfWeek},调用{@link DayOfWeek#getValue()}<br>
|
||||
* 如果为{@link Era},调用{@link Era#getValue()}
|
||||
*
|
||||
* @param temporalAccessor Date对象
|
||||
* @return {@link Instant}对象
|
||||
@@ -123,6 +125,10 @@ public class TemporalAccessorUtil extends TemporalUtil{
|
||||
public static long toEpochMilli(final TemporalAccessor temporalAccessor) {
|
||||
if(temporalAccessor instanceof Month){
|
||||
return ((Month) temporalAccessor).getValue();
|
||||
} else if(temporalAccessor instanceof DayOfWeek){
|
||||
return ((DayOfWeek) temporalAccessor).getValue();
|
||||
} else if(temporalAccessor instanceof Era){
|
||||
return ((Era) temporalAccessor).getValue();
|
||||
}
|
||||
return toInstant(temporalAccessor).toEpochMilli();
|
||||
}
|
||||
|
Reference in New Issue
Block a user