Classe ‘MessageFormat’: Afficher l’heure en format court

Author:


{filelink=5931}


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

public class HeureFormatCourt {
  public static void main(String[] argv) throws Exception {
    Object[] data = new Object[] { new Date(), new Date(0) };
    String msg = MessageFormat.format("Heure Format Court:{0,time,short} l''UTC {1,time,short}", data);
    System.out.println(msg);
  }
}
/* Affichage:
 * Heure Format Court:00:34 l'UTC 00:00
 *
 *
 */

A Voir sur le même Sujet:

  • messageformat format()
  • messageformat lecture fichier java
  • java.text.messageformat time long
  • Java

Leave a Reply

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