Classe ‘MessageFormat’: Afficher la date en format jj/mm/aa””

Author:


{filelink=5938}


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

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

    System.out.println(msg);
  }
}

/*
 * Affichage:
 * La Date: 22/08/11
 *
 */

Leave a Reply

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