java.time.ZonedDateTime.toLocalTime() 方法
描述
java.time.ZonedDateTime.toLocalTime() 方法获取此日期时间的 LocalTime 部分。
声明
以下是 java.time.ZonedDateTime.toLocalTime() 方法的声明。
public LocalTime toLocalTime()
返回值
此日期时间的时间部分,不为空。
示例
下面的例子展示了 java.time.ZonedDateTime.toLocalTime() 方法的使用。
package com.tutorialspoint;
import java.time.ZonedDateTime;
public class ZonedDateTimeDemo {
public static void main(String[] args) {
ZonedDateTime date = ZonedDateTime.now();
System.out.println(date.toLocalTime());
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
15:35:54.222

