Mega Code Archive

 
Categories / Java Tutorial / Internationalization
 

Format Date value in full length

import java.text.MessageFormat; import java.util.Date; public class Main {   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);   } } //8:31:58 o'clock AM PDT and UTC of 0 is 4:00:00 o'clock PM PST