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 * */ |
A voir sur le mêm Sujet
-
Classe ‘MessageFormat’: Afficher l’heure en format long (Exemple: 16:07:33 GMT)
{filelink=5933} import java.text.MessageFormat; import java.util.Date; public class HeureFormatLong { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), …
-
Classe ‘MessageFormat’: Afficher l’heure en format court
{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(), …
-
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(), …
-
Java: Afficher la date en format complet à l’aide de MessageFormat
{filelink=5941} import java.text.MessageFormat; import java.util.Date; public class FormatComplet { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date()}; …
-
Classe ‘MessageFormat’: Utiliser un format personnalisé pour l’heure et la Date
{filelink=5935} 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(), …
-
Classe ‘MessageFormat’: Formater un message qui contient l’heure et la date
{filelink=5930} import java.text.MessageFormat; import java.util.Date; public class FormatDateUTC { 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 d’affichage de date
{filelink=5936} 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(), …
-
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()}; …
-
Classe ‘MessageFormat’: Exemple de remplacement des ‘token’ dans une chaîne de caractère
{filelink=5923} import java.text.MessageFormat; public class ExempleMsgFormat { public static void main(String[] argv) { Object[] params = new Object[] { “Bienvenu”, “Paris”, “Berne”, “Londre” }; System.out.println(MessageFormat.format(“{0} …
-
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) …
-
Afficher la date en langue et format français
{filelink=738} import java.util.*; import java.text.*; public class DateFrance { public static void main(String[] argv) { Date date = new Date( ); // Créer une instance …
-
Classe ‘DateFormat’: Afficher la date en format jj/mm/aa
{filelink=6016} import java.text.DateFormat; import java.util.Date; class DateFormatCourt { public static void main(String args[]) { Date date = new Date(); DateFormat fd = DateFormat.getDateInstance(DateFormat.SHORT); System.out.println(“Format Court …
Cet article Classe ‘MessageFormat’: Afficher la date en format jj/mm/aa »” est apparu en premier sur .