import java.util.*;
import java.text.*;
/**
*
* @author brian
*
*/
public class Action {
public static void main(String[] args) {
String str = null;
String strZeroOutValue = "";
String myString = "Tue Oct 18 04:11:56 CST 2009";
try {
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
Date d = sdf.parse(myString);
Calendar c = Calendar.getInstance();
c.setTime(d);
String s = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
System.out.println(s);
} catch (Exception e) {
e.printStackTrace();
}
java.util.Locale local = java.util.Locale.CHINA;
String pattern = "yyyy-MM-dd kk:mm:ss zz";
String ymdtime = "yyyy-MM-dd";
String hmstime = "hh:mm:ss";
java.text.SimpleDateFormat df1 = new java.text.SimpleDateFormat(
pattern, local);
java.text.SimpleDateFormat df2 = new java.text.SimpleDateFormat(
ymdtime, local);
java.text.SimpleDateFormat df3 = new java.text.SimpleDateFormat(
hmstime, local);
java.util.Date date = new java.util.Date();
String time = df1.format(date);
String yyyymmdd = df2.format(date);
String hhmmss = df3.format(date);
System.out.println("yyyymmdd:" + yyyymmdd + "hhmmss:" + hhmmss
+ "time:" + time);
}
}