Java Date Time Java Java API
java.time.OffsetDateTime
public int getSecond()
Returns the second-of-minute field from this OffsetDateTime instance.
package com.logicbig.example.offsetdatetime;import java.time.LocalDateTime;import java.time.OffsetDateTime;import java.time.ZoneOffset;public class GetSecondExample { public static void main (String... args) { OffsetDateTime d = OffsetDateTime.of(LocalDateTime.of(2010, 10, 3, 11, 43, 30, 1000), ZoneOffset.ofHours(-5)); int second = d.getSecond(); System.out.println(second); }}
30