Close

Java Date Time - ZonedDateTime.getMonth() Examples

Java Date Time Java Java API 


Class:

java.time.ZonedDateTime

java.lang.Objectjava.lang.Objectjava.time.ZonedDateTimejava.time.ZonedDateTimejava.time.temporal.TemporalTemporaljava.time.chrono.ChronoZonedDateTimeChronoZonedDateTimejava.io.SerializableSerializableLogicBig

Method:

public Month getMonth()

Returns a Month enum instance, corresponding to the month-of-year field of this ZonedDateTime instance.

Examples


package com.logicbig.example.zoneddatetime;

import java.time.Month;
import java.time.ZonedDateTime;

public class GetMonthExample {

public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.now();
Month month = d.getMonth();
System.out.println(month);
}
}

Output

MAY




See Also