List of usage examples for java.text MessageFormat format
public static String format(String pattern, Object... arguments)
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("Today is {0,date,short} and UTC of 0 is {1,date,short}", params); System.out.println(msg);/*from w ww . j a v a 2 s . c om*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("{0,time,medium} and UTC of 0 is {1,time,medium}", params); System.out.println(msg);// w w w . j a v a 2s. c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("Today is {0,date,long} and UTC of 0 is {1,date,long}", params); System.out.println(msg);/*from w w w. j a v a 2 s. c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("Today is {0,date,medium} and UTC of 0 is {1,date,medium}", params); System.out.println(msg);/*from w w w . jav a 2 s.c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("{0,time,HH-mm-ss} and UTC of 0 is {1,time,HH-mm-ss}", params); System.out.println(msg);//www. ja v a 2 s .c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("{0,time,long} and UTC of 0 is {1,time,long}", params); System.out.println(msg);/* w w w.j a va 2s . com*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("{0,time,full} and UTC of 0 is {1,time,full}", params); System.out.println(msg);/* w w w.ja va 2 s.c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date(), new Date(0) }; String msg = MessageFormat.format("The time is {0} and UTC of 0 is {1}", params); msg = MessageFormat.format("The time is {0,time} and UTC of 0 is {1,time}", params); System.out.println(msg);/*from w ww.j a v a 2 s .c om*/ }
From source file:DateNumberSample.java
public static void main(String args[]) { Double kb = new Double(3.5); Date today = new Date(); String pattern = "{0}K was deleted on {1}."; Object[] arguments = { kb, today }; System.out.println(MessageFormat.format(pattern, arguments)); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Double kb = new Double(3.5); Date today = new Date(); String pattern = "{0}K was deleted on {1}."; Object[] arguments = { kb, today }; System.out.println(MessageFormat.format(pattern, arguments)); }