Source Code : Formatting a Message Containing a Time

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Formatting a Message Containing a Time

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("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);
  }
}

 

Thank with us