import java.text.MessageFormat; import java.util.Date; public class HeureFormatPersonnel { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("Heure Format personnel: {0,time,HH:mm:ss} l''UTC: {1,time,HH:mm:ss}", data); System.out.println(msg); } } // Heure Format personnel: 00:50:38 l'UTC: 00:00:00
A voir sur le même Sujet
-
Classe ‘MessageFormat’: Afficher l’heure en format complet(Ex: 12h30mn GMT)
{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(), …
-
Classe ‘MessageFormat’: Comment combiner la date avec des phrases
{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()}; …
-
Afficher la date en format moyen
{filelink=5939} import java.text.MessageFormat; import java.util.Date; public class FormatCourt { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date()}; …
-
Afficher la date en format long
{filelink=5940} import java.text.MessageFormat; import java.util.Date; public class FormatLong { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date() …
-
Classe ‘MessageFormat’: Exemple de Format pourcentage
{filelink=5929} import java.text.MessageFormat; public class FormatPoucentage { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Double(123.45), new Double(123.56) …
-
Classe ‘MessageFormat’: Exemple de Format monétaire
{filelink=5928} import java.text.MessageFormat; public class FormatMonnaie { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Double(250.50), new Double(650.15) …
-
Classe ‘MessageFormat’: Formater un Message qui contient un Nombre
{filelink=5924} import java.text.MessageFormat; public class ExempleMsgFormat2 { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Integer(1939), new Integer(1945) …
-
MessageFormat: Formater un message
{filelink=5925} import java.text.MessageFormat; public class ExempleFomat { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { “Fred”, “Jhon”, “Peter” }; …
-
Utiliser la classe ‘Formatter’ pour écrire dans un fichier
{filelink=5779} import java.io.FileOutputStream; import java.util.Formatter; public class FormatterFichier { public static void main(String[] argv) throws Exception { Formatter fmtCon = new Formatter(System.out); Formatter fmtFile; fmtFile …
-
Utilisation de la classe ‘DateFormat’ pour spécifier le format de la date
{filelink=5547} import java.text.DateFormat; import java.util.Date; import java.util.Locale; public class FormatageDate { public static void main(String[] args) { Date aujourdhui = new Date(); DateFormat fd = …