- java.time 包類
- java.time - 主頁
- java.time - 時鐘
- java.time - 持續時間
- java.time - Instant(即時)
- java.time - LocalDate(本地日期)
- java.time - LocalDateTime(本地日期時間)
- java.time - LocalTime(本地時間)
- java.time - MonthDay(月份日期)
- java.time - OffsetDateTime(偏移日期時間)
- java.time - OffsetTime(偏移時間)
- java.time - Period(期間)
- java.time - Year(年)
- java.time - YearMonth(年月份)
- java.time - ZonedDateTime(日期時間帶時區)
- java.time - ZoneId(時區 Id)
- java.time - ZoneOffset(時區偏移量)
- java.time 包列舉
- java.time - Month(月份)
- java.time 有用資源
- java.time - 討論
java.time.LocalDateTime.getSecond() 方法示例
說明
java.time.LocalDateTime.getSecond() 方法獲取分鐘的秒欄位。
宣告
以下是 java.time.LocalDateTime.getSecond() 方法的宣告。
public int getSecond()
返回值
從 0 到 59 的分鐘秒。
示例
以下示例展示了 java.time.LocalDateTime.getSecond() 方法的用法。
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.getSecond());
}
}
讓我們編譯並執行以上程式,這會產生以下結果 −
30
廣告