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()}; String msg = MessageFormat.format("Date {0,date,medium}", data); System.out.println(msg); } }
A voir sur le même Sujet
-
Afficher le fuseau horaire en format Complet ‘EST’
{filelink=6300} import java.text.SimpleDateFormat; import java.util.Date; public class FuseauHComplet { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat(“zzzz”); …
-
Afficher la date en format court avec le nom du mois
{filelink=5599} import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class DateCourte { public static void main(String[] argv) throws Exception { Format format = new SimpleDateFormat(“EEE, dd …
-
Afficher la date en Format lettre
{filelink=5596} import java.text.SimpleDateFormat; import java.util.Date; public class DateEnLettre { public static void main(String[] args) throws Exception { Date date = new Date(); SimpleDateFormat dateFormat; dateFormat …
-
Afficher Date et l’heure en format complet
{filelink=5595} import java.text.SimpleDateFormat; import java.util.Date; public class FormatComplet { public static void main(String[] argv) throws Exception { Date date = new Date(); SimpleDateFormat dateFormatComp; dateFormatComp …
-
Afficher le fuseau horaire en format z(RFC 822)
{filelink=6301} import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(“Z”); …
-
Afficher l’heure en format 12 heures
{filelink=5597} import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class HeureFormat12 { public static void main(String[] argv) throws Exception { // Format 12 heure Format formatter …
-
Exemple d’affichage de date avec et sans formatage
{filelink=5539} import java.text.SimpleDateFormat; import java.util.Date; public class ExempleDateEtFormat { public static void main(String[] args) { Date dNow = new Date(); /* Afficher la date avec …
-
Afficher le fuseau horaire (ex: GMT)
{filelink=6299} import java.text.SimpleDateFormat; import java.util.Date; public class FHoraire { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(“zzz”); …
-
Afficher la date complete avec le fuseau horaire
{filelink=5604} import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; public class EXDateComplete { public static void main(String[] argv) throws Exception { Format formatter = new SimpleDateFormat(“EEEE, dd …
-
Afficher la Date en format court(jj/mm/aa)
{filelink=5773} import java.util.Calendar; import java.util.Formatter; public class DateFormat { public static void main(String[] argv) throws Exception { Formatter fmt = new Formatter(); Calendar cal = …