Exemple de méthode java.time.ZonedDateTime.getMonth ()

La description

le java.time.ZonedDateTime.getMonth() La méthode obtient le champ du mois de l'année à l'aide de l'énumération Month.

Déclaration

Voici la déclaration pour java.time.ZonedDateTime.getMonth() méthode.

public Month getMonth()

Valeur de retour

le mois de l'année, non nul.

Exemple

L'exemple suivant montre l'utilisation de la méthode java.time.ZonedDateTime.getMonth ().

package com.tutorialspoint;

import java.time.ZonedDateTime;

public class ZonedDateTimeDemo {
   public static void main(String[] args) {
 
      ZonedDateTime date = ZonedDateTime.parse("2017-03-28T12:25:38.492+05:30[Asia/Calcutta]");
      System.out.println(date.getMonth());  
   }
}

Compilons et exécutons le programme ci-dessus, cela produira le résultat suivant -

MARCH