Java DateFormat.getCalendar()

Syntax

DateFormat.getCalendar() has the following syntax.

public Calendar getCalendar()

Example

In the following code shows how to use DateFormat.getCalendar() method.


/*from  w  w w.  j  ava 2s  . c o m*/
import java.text.DateFormat;
import java.util.Date;

public class Main {
  public static void main(String[] argv) throws Exception {
    DateFormat dateFormat = DateFormat.getDateTimeInstance();
    
    
    String s = dateFormat.format(new Date());
    System.out.println(dateFormat.getCalendar());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.text »




DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat