/*
 * Created on 2005-5-8
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.chapter2;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author Administrator
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class DateTimeOperation {

	public static void main(String[] args) {

		DateFormat df = DateFormat.getDateInstance();

		Date date = new Date();
		df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
				DateFormat.DEFAULT);
		System.out.println("DateFormat.DEFAULT:" + df.format(date));

		df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
		System.out.println("DateFormat.SHORT  :" + df.format(date));

		df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
				DateFormat.MEDIUM);
		System.out.println("DateFormat.MEDIUM :" + df.format(date));

		df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
		System.out.println("DateFormat.LONG   :" + df.format(date));

		df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
		System.out.println("DateFormat.FULL   :" + df.format(date));

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/mm/dd");
		System.out.println("SimpleDateFormat   :" + sdf.format(date));

		Calendar cl = Calendar.getInstance();
		System.out.println(cl.getTime());
		System.out.println(cl.get(Calendar.DATE));
		System.out.println(cl.get(Calendar.DAY_OF_MONTH));
		System.out.println(cl.get(Calendar.DAY_OF_WEEK));
		System.out.println(cl.get(Calendar.DAY_OF_WEEK_IN_MONTH));
		System.out.println(cl.get(Calendar.DAY_OF_YEAR));
		System.out.println(cl.get(Calendar.HOUR_OF_DAY));
		System.out.println(cl.get(Calendar.MINUTE));

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	public boolean equals(Object arg0) {
		// TODO Auto-generated method stub

		return super.equals(arg0);
	}
}
