java.time.LocalTime.atOffset() 方法示例


java.time.LocalTime.atOffset() 方法示例

package com.codingdict;

import java.time.LocalTime;
import java.time.OffsetTime;
import java.time.ZoneOffset;

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

      LocalTime time = LocalTime.parse("12:30:30");
      System.out.println(time);  
      OffsetTime time1 = time.atOffset(ZoneOffset.ofHours(2));
      System.out.println(time1);  
   }
}