Obténir le jour, année et mois actuel

Author:


Download

 
import java.util.Calendar;
 
public class DetDate {
 
  public static void main(String[] args)
  {
    Calendar now = Calendar.getInstance();
 
    // Afficher Jour
    System.out.println("Jour : " + now.get(Calendar.DATE));
    // Afficher mois
    System.out.println("Mois : " + (now.get(Calendar.MONTH) + 1));
      // Afficher l'année
    System.out.println("Année : " + now.get(Calendar.YEAR));
  }
}