Example usage for java.time Month AUGUST

List of usage examples for java.time Month AUGUST

Introduction

In this page you can find the example usage for java.time Month AUGUST.

Prototype

Month AUGUST

To view the source code for java.time Month AUGUST.

Click Source Link

Document

The singleton instance for the month of August with 31 days.

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.AUGUST;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.AUGUST, 3);
    System.out.println(localDate);
    Month month1 = Month.from(localDate);
    System.out.println(month1);// w w w .j  a v  a  2  s. c o  m

    Month month2 = Month.of(2);
    System.out.println(month2);

    Month month3 = month2.plus(2);
    System.out.println(month3);

    Month month4 = localDate.getMonth();
    System.out.println(month4);

    int monthIntValue = month2.getValue();
    System.out.println(monthIntValue);
}

From source file:Main.java

public static void main(String[] args) {

    LocalDateTime l = LocalDateTime.of(2012, Month.AUGUST, 13, 0, 0, 0);
    ZonedDateTime z = ZonedDateTime.of(LocalDateTime.of(2014, Month.AUGUST, 13, 0, 0, 0),
            ZoneId.of("America/Los_Angeles"));

    Duration duration = Duration.between(l, z);

    System.out.println(duration);
}

From source file:Main.java

@Override
public Boolean queryFrom(TemporalAccessor date) {
    int month = date.get(ChronoField.MONTH_OF_YEAR);
    if (month == Month.JULY.getValue() || month == Month.AUGUST.getValue()) {
        return true;
    }//  w  w  w.j  av a2 s.c o m
    return false;
}

From source file:cz.muni.fi.javaseminar.kafa.bookregister.AuthorManagerImplTest.java

@Before
public void setUp() throws SQLException, FileNotFoundException {
    manager = (AuthorManagerImpl) CTX.getBean("authorManager");
    dataSource = manager.getDataSource();
    DBUtils.executeSqlScript(dataSource, BookManager.class.getResource(SQL_SCRIPT_NAME));

    authorOlda = Author.builder().firstname("Oldrich").surname("Faldik").nationality("Czech")
            .description("Novodoby autor").dateOfBirth(LocalDate.of(1990, Month.JANUARY, 20));

    authorKarel = Author.builder().firstname("Karel").surname("Soukup").nationality("Czech")
            .description("Stredovek").dateOfBirth(LocalDate.of(1450, Month.AUGUST, 12));
}

From source file:Main.java

public Boolean queryFrom(TemporalAccessor date) {
    int month = date.get(ChronoField.MONTH_OF_YEAR);
    int day = date.get(ChronoField.DAY_OF_MONTH);

    // Disneyland over Spring Break
    if ((month == Month.APRIL.getValue()) && ((day >= 3) && (day <= 8)))
        return Boolean.TRUE;

    // Smith family reunion on Lake Saugatuck
    if ((month == Month.AUGUST.getValue()) && ((day >= 8) && (day <= 14)))
        return Boolean.TRUE;

    return Boolean.FALSE;
}

From source file:example.app.core.mapping.json.jackson.serialization.JsonToObjectMappingIntegrationTests.java

@Test
public void convertPieDoeJsonToContactIsSuccessful() throws Exception {
    ObjectMapper objectMapper = LocalDateDeserializer.register(new ObjectMapper());

    Contact contact = objectMapper.readValue(toInputStream("/pieDoeWithBirthDateContact.json"), Contact.class);

    System.err.printf("Contact is [%s]%n", contact);

    assertThat(contact).isNotNull();//from  www.  j ava  2 s. co  m
    assertThat(contact.getId()).isEqualTo(3L);
    assertThat(contact.getEmail()).isEqualTo("pieDoe@springone.com");

    Person pieDoe = contact.getPerson();

    assertPerson(pieDoe, "Pie Doe", Gender.FEMALE, LocalDate.of(2000, Month.AUGUST, 4));

    Address address = contact.getAddress();

    assertAddress(address, "3730 S Las Vegas Blvd", "Las Vegas", State.NEVADA, "89158");

    PhoneNumber phoneNumber = contact.getPhoneNumber();

    assertPhoneNumber(phoneNumber, "702", "590", "7111", null);
}

From source file:se.backede.jeconomix.forms.report.SingleTransactionReport.java

private DefaultCategoryDataset createDataset(TransactionReportDto reports) {

    String lineTitle = "Kronor";

    Map<Month, BigDecimal> sums = new HashMap<>();

    List<Month> monthList = new LinkedList<>(Arrays.asList(Month.values()));

    monthList.forEach((month) -> {/*w ww. ja v a  2 s  .c  o m*/
        sums.put(month, BigDecimal.valueOf(0));
    });

    reports.getTransctions().forEach((TransactionDto transaction) -> {
        monthList.stream().filter((month) -> (transaction.getBudgetMonth().equals(month)))
                .forEachOrdered((month) -> {
                    BigDecimal currentSum = sums.get(month);
                    if (transaction.getSum() != null) {
                        double abs = Math.abs(transaction.getSum().doubleValue());
                        BigDecimal newSum = currentSum.add(BigDecimal.valueOf(abs));
                        sums.put(month, newSum);
                    }
                });
    });

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(sums.get(Month.JANUARY), lineTitle, "Jan");
    dataset.addValue(sums.get(Month.FEBRUARY), lineTitle, "Feb");
    dataset.addValue(sums.get(Month.MARCH), lineTitle, "Mar");
    dataset.addValue(sums.get(Month.APRIL), lineTitle, "Apr");
    dataset.addValue(sums.get(Month.MAY), lineTitle, "May");
    dataset.addValue(sums.get(Month.JUNE), lineTitle, "Jun");
    dataset.addValue(sums.get(Month.JULY), lineTitle, "Jul");
    dataset.addValue(sums.get(Month.AUGUST), lineTitle, "Aug");
    dataset.addValue(sums.get(Month.SEPTEMBER), lineTitle, "Sep");
    dataset.addValue(sums.get(Month.OCTOBER), lineTitle, "Oct");
    dataset.addValue(sums.get(Month.NOVEMBER), lineTitle, "Nov");
    dataset.addValue(sums.get(Month.DECEMBER), lineTitle, "Dec");
    return dataset;
}

From source file:org.kitodo.dataeditor.ruleset.RulesetManagementIT.java

/**
 * This test checks whether the date scheme and the field are correctly read
 * out for divisions that are subdivided by date.
 */// w  ww  .j  a  v  a 2  s . c  o  m
@Test
public void testDivisionsSubdividedByDateReportDateSchemeAndField() throws IOException {
    RulesetManagement underTest = new RulesetManagement();
    underTest.load(new File("src/test/resources/testDivisionsSubdividedByDateReportDateSchemeAndField.xml"));

    StructuralElementViewInterface playtimeSevi = underTest.getStructuralElementView("playtime", "", ENGL);
    assertThat(playtimeSevi.getDatesSimpleMetadata(), is(Optional.empty()));

    StructuralElementViewInterface yearSevi = underTest.getStructuralElementView("playtimeYear", "", ENGL);
    assertThat(yearSevi.getDatesSimpleMetadata(), is(not(Optional.empty())));
    DatesSimpleMetadataViewInterface yearDsmvi = yearSevi.getDatesSimpleMetadata().get();
    assertEquals("ORDERLABEL", yearDsmvi.getId());
    assertEquals("yyyy/yyyy", yearDsmvi.getScheme());
    assertEquals(MonthDay.of(Month.AUGUST, 1), yearDsmvi.getYearBegin());

    StructuralElementViewInterface monthSevi = underTest.getStructuralElementView("playtimeMonth", "", ENGL);
    assertThat(monthSevi.getDatesSimpleMetadata(), is(not(Optional.empty())));
    DatesSimpleMetadataViewInterface monthDsmvi = monthSevi.getDatesSimpleMetadata().get();
    assertEquals("ORDERLABEL", monthDsmvi.getId());
    assertEquals("yyyy-MM", monthDsmvi.getScheme());

    StructuralElementViewInterface daySevi = underTest.getStructuralElementView("playtimeDay", "", ENGL);
    assertThat(daySevi.getDatesSimpleMetadata(), is(not(Optional.empty())));
    DatesSimpleMetadataViewInterface dayDsmvi = daySevi.getDatesSimpleMetadata().get();
    assertEquals("ORDERLABEL", dayDsmvi.getId());
    assertEquals("yyyy-MM-dd", dayDsmvi.getScheme());
}