Example usage for java.time Month MAY

List of usage examples for java.time Month MAY

Introduction

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

Prototype

Month MAY

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.MAY;
    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 dob = LocalDate.of(1971, Month.MAY, 16);
    System.out.printf("%1$tB %1$td,  %1$tY is %2$s's birth day. Let's go and celebrate.", dob, "Mike");
}

From source file:Main.java

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

    LocalDate localDate2 = localDate1.withYear(2015);
    System.out.println(localDate2);

    LocalDate localDate3 = localDate1.withYear(2014).withMonth(7);
    System.out.println(localDate3);

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.MAY, 21);
    System.out.println(ld1);//from w w w  . j av a  2s  . com
    LocalDate ld2 = ld1.with(TemporalAdjusters.dayOfWeekInMonth(5, DayOfWeek.SUNDAY));
    System.out.println(ld2);
}

From source file:Main.java

public static void main(String[] args) {
    ZoneId usCentral = ZoneId.of("America/Chicago");
    LocalDateTime localDateTime = LocalDateTime.of(2014, Month.MAY, 21, 9, 30);
    System.out.println(localDateTime);
    ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, usCentral);
    System.out.println(zonedDateTime);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.JANUARY, 7);
    LocalDate ld2 = LocalDate.of(2014, Month.MAY, 21);
    long days = ChronoUnit.DAYS.between(ld1, ld2);
    System.out.println(days);/* w ww .ja v  a 2s.c om*/

    LocalTime lt1 = LocalTime.of(6, 0);
    LocalTime lt2 = LocalTime.of(9, 30);
    long hours = ChronoUnit.HOURS.between(lt1, lt2);
    System.out.println(hours);
    long minutes = ChronoUnit.MINUTES.between(lt1, lt2);
    System.out.println(minutes);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.JANUARY, 7);
    LocalDate ld2 = LocalDate.of(2014, Month.MAY, 18);

    LocalTime lt1 = LocalTime.of(7, 0);
    LocalTime lt2 = LocalTime.of(9, 30);

    long days = ld1.until(ld2, ChronoUnit.DAYS);
    System.out.println(days);/*w w  w  .j a  v a  2  s  .  co m*/
    long hours = lt1.until(lt2, ChronoUnit.HOURS);
    System.out.println(hours);
    long minutes = lt1.until(lt2, ChronoUnit.MINUTES);
    System.out.println(minutes);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);

    Temporal i = dayOfWeek.adjustInto(LocalDate.of(2014, Month.MAY, 22));
    System.out.println(i);//from   ww w  . j  av  a 2 s  .  c o m

}

From source file:Main.java

public static List<Employee> persons() {
    Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343);
    Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100);
    Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455);
    Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800);
    Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234);
    Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211);

    List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6);

    return persons;
}

From source file:Main.java

public static List<Employee> persons() {
    Employee p1 = new Employee(1, "Jake", Gender.MALE, LocalDate.of(1971, Month.JANUARY, 1), 2343.0);
    Employee p2 = new Employee(2, "Jack", Gender.MALE, LocalDate.of(1972, Month.JULY, 21), 7100.0);
    Employee p3 = new Employee(3, "Jane", Gender.FEMALE, LocalDate.of(1973, Month.MAY, 29), 5455.0);
    Employee p4 = new Employee(4, "Jode", Gender.MALE, LocalDate.of(1974, Month.OCTOBER, 16), 1800.0);
    Employee p5 = new Employee(5, "Jeny", Gender.FEMALE, LocalDate.of(1975, Month.DECEMBER, 13), 1234.0);
    Employee p6 = new Employee(6, "Jason", Gender.MALE, LocalDate.of(1976, Month.JUNE, 9), 3211.0);
    List<Employee> persons = Arrays.asList(p1, p2, p3, p4, p5, p6);
    return persons;
}