java.time.ZonedDateTime.ofStrict() 方法示例


java.time.ZonedDateTime.ofStrict() 方法示例

package com.codingdict;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.ZoneId;

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

      ZonedDateTime date = ZonedDateTime.ofStrict(LocalDateTime.now(), ZoneOffset.UTC, ZoneId.of("Z"));
      System.out.println(date);  
   }
}