Example usage for java.time Month JULY

List of usage examples for java.time Month JULY

Introduction

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

Prototype

Month JULY

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.JULY;
    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) {
    Month month = Month.JULY;
    int dayOfMonth = 14;

    MonthDay jugIL = MonthDay.of(month, dayOfMonth);

    System.out.println(jugIL);/*from  ww w  .j a va2s .c  o  m*/
}

From source file:Main.java

public static void main(String[] args) {
    int year = 2014;
    Month month = Month.JULY;
    int dayOfMonth = 14;
    LocalDate jugILThisYear = LocalDate.of(year, month, dayOfMonth);

    System.out.println(jugILThisYear);
}

From source file:Main.java

public static void main(String... args) {
    LocalDate independenceDay = LocalDate.of(2014, Month.JULY, 4);
    DayOfWeek dayOfWeek = independenceDay.getDayOfWeek();
    System.out.println(dayOfWeek); // FRIDAY

}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime leaving = LocalDateTime.of(2013, Month.JULY, 20, 19, 30);

    ZoneId leavingZone = ZoneId.of("America/Los_Angeles");
    ZonedDateTime departure = ZonedDateTime.of(leaving, leavingZone);

    System.out.println(departure);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate date = LocalDate.of(2014, Month.JULY, 16);
    System.out.println(date);/*from  w w  w  .j a  v  a2s.c o m*/

    LocalDate firstDayOfJuly = date.with(TemporalAdjusters.firstDayOfMonth()); // 2014-07-01
    System.out.println(firstDayOfJuly);

    LocalDate dateOfFirstMonday = date.with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)); // 2014-07-07
    System.out.println(dateOfFirstMonday);

}

From source file:Main.java

public static void main(String[] args) {
    // using offsets
    LocalDateTime date = LocalDateTime.of(2013, Month.JULY, 20, 3, 30);
    ZoneOffset offset = ZoneOffset.of("+05:00");

    // 2013-07-20 22:30 +05:00
    OffsetDateTime plusFive = OffsetDateTime.of(date, offset);
    System.out.println(plusFive);

    // 2013-07-19 20:30 -02:00
    OffsetDateTime minusTwo = plusFive.withOffsetSameInstant(ZoneOffset.ofHours(-2));

    System.out.println(minusTwo);
}

From source file:Main.java

public static void main(String[] args) {
    DateTimeFormatter format = DateTimeFormatter.ofPattern("MMM d yyyy  hh:mm a");
    LocalDateTime leaving = LocalDateTime.of(2013, Month.JULY, 20, 19, 30);

    // Leaving from San Francisco on July 20, 2013, at 7:30 p.m.

    ZoneId leavingZone = ZoneId.of("America/Los_Angeles");
    ZonedDateTime departure = ZonedDateTime.of(leaving, leavingZone);

    String out1 = departure.format(format);
    System.out.printf("LEAVING:  %s (%s)%n", out1, leavingZone);

    // Flight is 10 hours and 50 minutes, or 650 minutes
    ZoneId arrivingZone = ZoneId.of("Asia/Tokyo");
    ZonedDateTime arrival = departure.withZoneSameInstant(arrivingZone).plusMinutes(650);

    String out2 = arrival.format(format);
    System.out.printf("ARRIVING: %s (%s)%n", out2, arrivingZone);

}

From source file:Main.java

public static void main(String[] args) {

    YearMonth yearMonth = YearMonth.of(2014, 6);
    System.out.println(yearMonth.query(new SchoolHolidayQuery())); // false
    System.out.println(YearMonth.of(2014, Month.JULY).query(new SchoolHolidayQuery())); // true
    System.out.println(YearMonth.of(2014, 8).query(new SchoolHolidayQuery())); // true

}

From source file:Main.java

public static void main(String[] args) {
    LocalTime now = LocalTime.now();
    LocalTime currentTimeInLosAngeles = LocalTime.now(ZoneId.of("America/Los_Angeles"));
    System.out.println(String.format("now is %s and in LA is %s", now, currentTimeInLosAngeles));

    ZoneId leavingZone = ZoneId.of("Asia/Tel_Aviv");
    ZoneId arrivingZone = ZoneId.of("America/New_York");

    LocalDateTime leaving = LocalDateTime.of(2014, Month.JULY, 16, 23, 00);
    ZonedDateTime departure = ZonedDateTime.of(leaving, leavingZone);

    ZonedDateTime arrival = departure.withZoneSameInstant(arrivingZone).plusHours(11).plusMinutes(51);

    DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-d  HH:mm");
    System.out.println(String.format("Departure: %s", departure.format(format)));
    System.out.println(String.format("Arrival: %s", arrival.format(format)));
}