Classe ‘MessageFormat’: Afficher l’heure en format complet(Ex: 12h30mn GMT)

Author:


{filelink=5934}


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

public class HeureFormatComplet {
  public static void main(String[] argv) throws Exception {
    Object[] data = new Object[] { new Date(), new Date(0) };
    String  msg = MessageFormat.format("Heure Format Complet: {0,time,full} L''UTC est: {1,time,full}", data);

    System.out.println(msg);
  }
}
//Heure Format Complet: 00 h 44 GMT L'UTC est: 00 h 00 GMT

Leave a Reply

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