Tuesday, March 3, 2015

Display hour and minute in a java pgm



Display hour and minute

import java.util.Calendar;
import java.util.Formatter;
 public class MainClass
{
   public static void main(String args[])
  {
      Formatter fmt = new Formatter();
      Calendar cal = Calendar.getInstance();
      fmt = new Formatter();
      fmt.format("%tl:%tM", cal, cal);
      System.out.println(fmt);
   }
}

No comments:

Post a Comment