java.time.OffsetDateTime.toLocalDateTime() 方法示例



描述

java.time.OffsetDateTime.toLocalDate() 方法獲取此日期時間的 LocalDateTime 部分。

宣告

以下是 java.time.OffsetDateTime.toLocalDateTime() 方法的宣告。

public LocalDateTime toLocalDateTime()

public LocalDateTime toLocalDateTime()

返回值

此日期時間中不可為 null 的本地日期部分。

示例

package com.tutorialspoint;

import java.time.OffsetDateTime;

public class OffsetDateTimeDemo {
   public static void main(String[] args) {
 
      OffsetDateTime date = OffsetDateTime.now();
      System.out.println(date.toLocalDateTime());  
   }
}

模擬演示

2017-03-21T14:17:50.944
列印頁面
© . All rights reserved.