Close

Java Date Time - ZonedDateTime.getMonthValue() 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 int getMonthValue()

Returns the month-of-year field as int.

Examples


package com.logicbig.example.zoneddatetime;

import java.time.ZonedDateTime;

public class GetMonthValueExample {

public static void main(String... args) {
ZonedDateTime d = ZonedDateTime.now();
int monthValue = d.getMonthValue();
System.out.println(monthValue);
}
}

Output

5




See Also