Classe ‘MessageFormat’: Comment combiner la date avec des phrases

Author:


{filelink=5937}


import java.text.MessageFormat;
import java.util.Date;

public class AffichageMois {
  public static void main(String[] argv) throws Exception {
    Object[] params = new Object[] { new Date()};
    String msg = MessageFormat.format("La date du jour: {0,date}", params);

    System.out.println(msg);
  }
}

/*
 * Affichage:
 * La date du jour: 22 ao�t 2011
 *
 **/

Leave a Reply

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