Classe ‘MessageFormat’: Afficher l’heure en format moyen (exemple: 16:05:42)

Author:


{filelink=5932}


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

public class HeureFormatMoyen {
  public static void main(String[] argv) throws Exception {
    Object[] data = new Object[] { new Date(), new Date(0) };
    String msg = MessageFormat.format("Heure Format Moyen:{0,time,medium} l''UTC {1,time,medium}", data);

    System.out.println(msg);
  }
}

/*
 * Sortie:
 * Heure Format Moyen:00:38:10 l'UTC 00:00:00
 *
 *
 /

Leave a Reply

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