Date Complete time and date format(%tc)


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("%tc", cal);
    System.out.println(fmt);

  }
}

Output:


Wed Jun 11 10:39:58 PDT 2008
Home 
  Java Book 
    Runnable examples  

Formatter:
  1. Date Complete time and date format(%tc)
  2. Date hour and minute format(%tl:%tM)
  3. Date Month name and number format(%tB %tb %tm)
  4. Date Standard 12-hour time format(%tr)