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


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

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.ofLocal(LocalDateTime.now(), ZoneId.systemDefault(),ZoneOffset.UTC );
      System.out.println(date);  
   }
}