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



說明

java.time.OffsetDateTime.getNano() 方法獲取毫秒場中納秒級的毫秒欄位。

宣告

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

public int getNano()

返回值

從 0 到 999,999,999 的納秒級毫秒。

示例

以下示例演示了 java.time.OffsetDateTime.getNano() 方法的使用。

package com.tutorialspoint;

import java.time.OffsetDateTime;

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

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

0
廣告
© . All rights reserved.