Example usage for java.time Month MARCH

List of usage examples for java.time Month MARCH

Introduction

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

Prototype

Month MARCH

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.MARCH;
    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) {
    MonthDay m = MonthDay.of(Month.MARCH, 21);

    System.out.println(m);

}

From source file:Main.java

public static void main(String[] argv) {
    LocalDate today = LocalDate.now();
    LocalDate java8Release = LocalDate.of(2014, Month.MARCH, 14);
    Period period = Period.between(java8Release, today);
    System.out.println("Period between today and Java 8 release : " + period);
    System.out.println("Period between Java 8 release and today : " + Period.between(today, java8Release));

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate1 = LocalDate.of(2014, 5, 21);
    System.out.println(localDate1);

    LocalDate localDate2 = LocalDate.of(2014, Month.MARCH, 4);
    System.out.println(localDate2);

    LocalDate localDate3 = LocalDate.ofEpochDay(2014);
    System.out.println(localDate3);

    LocalDate localDate4 = LocalDate.ofYearDay(2014, 39);
    System.out.println(localDate4);
}

From source file:Main.java

public static void main(String[] args) {
    ZoneId usCentral = ZoneId.of("America/Chicago");
    LocalDateTime ldt = LocalDateTime.of(2012, Month.MARCH, 10, 7, 30);
    ZonedDateTime zdt1 = ZonedDateTime.of(ldt, usCentral);
    Period p1 = Period.ofDays(1);

    ZonedDateTime zdt2 = zdt1.plus(p1);
    System.out.println(zdt2);//from  w w  w. j  a  va2  s. com
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime zdt1 = ZonedDateTime.now();
    System.out.println("Current zoned  datetime:" + zdt1);

    LocalDateTime ldt = LocalDateTime.of(2012, Month.MARCH, 11, 7, 30);

    ZoneId usCentralZone = ZoneId.of("America/Chicago");
    ZonedDateTime zdt2 = ZonedDateTime.of(ldt, usCentralZone);
    System.out.println(zdt2);//from  w w  w  .  j a v a  2  s .c  o m
}

From source file:Main.java

public static void main(String[] args) {
    ZoneId usChicago = ZoneId.of("America/Chicago");

    // 2014-03-09T02:30 did not exist in America/Chicago time zone
    LocalDateTime ldt = LocalDateTime.of(2014, Month.MARCH, 9, 2, 30);
    ZonedDateTime zdt = ZonedDateTime.of(ldt, usChicago);
    System.out.println(zdt);// w  w  w  .  jav  a  2s  .  c o m

    // 2013-10-03T01:30 existed twice in America/Chicago time zone
    LocalDateTime ldt2 = LocalDateTime.of(2013, Month.NOVEMBER, 3, 1, 30);
    ZonedDateTime zdt2 = ZonedDateTime.of(ldt2, usChicago);

    System.out.println(zdt2.withEarlierOffsetAtOverlap());
    System.out.println(zdt2.withLaterOffsetAtOverlap());

}

From source file:com.ewerk.prototype.persistence.repositories.PersonRepositoryCustomIntegTest.java

@BeforeTest
public void setup() {
    final LocalDate birthday = LocalDate.of(2000, Month.MARCH, 2);

    john = new Person();
    john.setLastName("Smith");
    john.setFirstName("John");
    john.setBirthday(birthday);/*from   ww  w .  j  a  va 2 s.c  om*/
}

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) -> {//from  ww  w.  j  a va2s .co  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;
}