Affichier les mois de l’année

Author:


{filelink=5575}


import java.util.Calendar;

public class MoisAnnee {
  public static void main(String[] args) {
    Calendar maintenant = Calendar.getInstance();

    System.out.println("Date complete : " + (maintenant.get(Calendar.MONTH) + 1) + "-"
        + maintenant.get(Calendar.DATE) + "-" + maintenant.get(Calendar.YEAR));

    String[] nomMois = new String[] { "Jan", "Fev", "Mar", "Avr", "Mai", "Juin", "Jul", "Aoû",
        "Sep", "Oct", "Nov", "Dec" };
    System.out.println("La date courante est : " + nomMois[maintenant.get(Calendar.MONTH)]);

  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *