Example usage for java.time Month APRIL

List of usage examples for java.time Month APRIL

Introduction

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

Prototype

Month APRIL

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

Click Source Link

Document

The singleton instance for the month of April with 30 days.

Usage

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.APRIL;
    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 a = LocalDate.of(2014, Month.APRIL, 10);

    System.out.println(a);
}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now();

    System.out.println(m.equals(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now();

    System.out.println(m.isAfter(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now();

    System.out.println(m.isBefore(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    MonthDay m = MonthDay.now();

    System.out.println(m.compareTo(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.isValidMonthDay(MonthDay.of(Month.APRIL, 1)));

}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime localDateTime = LocalDateTime.of(1982, Month.APRIL, 17, 14, 11);
    ZonedDateTime jakartaTime = ZonedDateTime.of(localDateTime, ZoneId.of("Asia/Jakarta"));
    System.out.println(jakartaTime); //1982-04-17T14:11+07:00[Asia/Jakarta]

    System.out.println(jakartaTime.withZoneSameInstant(ZoneId.of("America/Los_Angeles"))); //1982-04-16T23:11-08:00[America/Los_Angeles]
    System.out.println(jakartaTime.withZoneSameLocal(ZoneId.of("America/New_York"))); //1982-04-17T14:11-05:00[America/New_York]

}

From source file:Main.java

public static void main(String[] args) {
    // 2014-04-01 10:45
    LocalDateTime dateTime = LocalDateTime.of(2014, Month.APRIL, 1, 10, 45);

    // format as ISO week date (2014-W08-4)
    String asIsoWeekDate = dateTime.format(DateTimeFormatter.ISO_WEEK_DATE);

    System.out.println(asIsoWeekDate);
}

From source file:Main.java

public static void main(String[] args) {
    // 2014-04-01 10:45
    LocalDateTime dateTime = LocalDateTime.of(2014, Month.APRIL, 1, 10, 45);

    // format ISO date time (2014-02-20T20:04:05.867)
    String asIsoDateTime = dateTime.format(DateTimeFormatter.ISO_DATE_TIME);

    System.out.println(asIsoDateTime);
}