java.time.LocalDateTime.getNano() 方法示例



描述

java.time.LocalDateTime.getNano() 方法獲取納秒欄位。

宣告

以下是對 java.time.LocalDateTime.getNano() 方法的宣告。

public int getNano()

返回的值

納秒,從 0 到 999,999,999。

示例

以下示例顯示 java.time.LocalDateTime.getNano() 方法的用法。

package com.tutorialspoint;

import java.time.LocalDateTime;

public class LocalDateTimeDemo {
   public static void main(String[] args) {
 
      LocalDateTime date = LocalDateTime.parse("2017-02-03T12:30:30");
      System.out.println(date.getNano());  
   }
}

讓我們編譯並執行上述程式,結果如下所示:-

0
廣告
© . All rights reserved.