java.time.Instant.from() 方法示例


java.time.Instant.from() 方法示例

package com.codingdict;

import java.time.Instant;
import java.time.ZonedDateTime;

public class InstantDemo {
   public static void main(String[] args) {

      ZonedDateTime zonedDateTime = ZonedDateTime.now();

      Instant instant = Instant.from(zonedDateTime);

      System.out.println(instant);
   }
}