This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Instant 에서 milliseconds 값 얻기

jinahya(25)
Published in
#java
Words
16
Reading
1 min
Listen
Play
8y

Instant#getEphochSecond()I1970-01-01T00:00:00Z 를 기준으로 초의 개수를 반환한다.
Instant#getNanos()JgetEpochSecons 메서드가 반환하는 초 이후의 나노초 값을 반한한다.

static Long millisOf(final Instant instant) {
        return ofNullable(instant)
                .map(v -> TimeUnit.SECONDS.toMillis(v.getEpochSecond())
                          + TimeUnit.NANOSECONDS.toMillis(v.getNano()))
                .orElse(null);
}
Instant 에서 milliseconds 값 얻기 | Ecency