Example usage for java.time OffsetTime getMinute

List of usage examples for java.time OffsetTime getMinute

Introduction

In this page you can find the example usage for java.time OffsetTime getMinute.

Prototype

public int getMinute() 

Source Link

Document

Gets the minute-of-hour field.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    int n = m.getMinute();
    System.out.println(n);//from w  w w.  jav a 2 s  .c o  m

}

From source file:io.sqp.core.types.SqpTimeTest.java

@Test
public void CanDecodeFromJson() throws Exception {
    String content = "[[13, 52, 5, 123456],7260]";
    ObjectMapper mapper = JacksonObjectMapperFactory.objectMapper(DataFormat.Text);

    Object timeObj = mapper.readValue(content, Object.class);
    SqpTime sqpTime = SqpTime.fromJsonFormatValue(timeObj);

    assertThat(sqpTime.hasOffset(), is(true));
    OffsetTime offsetTime = sqpTime.asOffsetTime();
    assertThat(offsetTime.getHour(), is(13));
    assertThat(offsetTime.getMinute(), is(52));
    assertThat(offsetTime.getSecond(), is(5));
    assertThat(offsetTime.getNano(), is(123456));
    assertThat(offsetTime.getOffset().getTotalSeconds(), is(7260));
}

From source file:io.sqp.core.types.SqpTimeTest.java

@Test
public void CanDecodeFromJsonWithoutOffset() throws Exception {
    String content = "[[13, 52, 5, 123456]]";
    ObjectMapper mapper = JacksonObjectMapperFactory.objectMapper(DataFormat.Text);

    Object timeObj = mapper.readValue(content, Object.class);
    SqpTime sqpTime = SqpTime.fromJsonFormatValue(timeObj);

    assertThat(sqpTime.hasOffset(), is(false));
    OffsetTime offsetTime = sqpTime.asOffsetTime();
    assertThat(offsetTime.getHour(), is(13));
    assertThat(offsetTime.getMinute(), is(52));
    assertThat(offsetTime.getSecond(), is(5));
    assertThat(offsetTime.getNano(), is(123456));
    assertThat(offsetTime.getOffset().getTotalSeconds(), is(0));
}