Use this method
Long time = Date.parse ("Sun Feb 10:31:58 +0800)";
SimpleDateFormat sdf=new SimpleDateFormat ("Yyyy-mm-dd");
Date d = new date (time);
System.out.println (Sdf.format (d));
Time format in the United States
G Era identifier Text AD
Y year 1996; 96
M years of the month Month July; June June; 07
Number of weeks in W year 27
Number of weeks in the W month 2
Number of days in D year 189
Days in D of month Number 10
Week number 2 in the F month
Days of E week Text Tuesday; Tue
A am/pm tagged Text pm
H hours in a day (0-23) number 0
K Hours in a day (1-24) Number 24
Hours in K-am/pm (0-11) number 0
H am/pm hours (1-12) Number 12
Minutes in M-hour number 30
s minutes in seconds number 55
S milliseconds number 978
Z Time zone zone Pacific Standard; PST; gmt-08:00
Z timezone RFC 822 time zone-0800
DateFormat df = dateformat.getdatetimeinstance (Dateformat.full, Dateformat.full, Locale.china);
SimpleDateFormat SDF = new SimpleDateFormat ("EEE MMM dd HH:mm:ss zzzzz", yyyy);
Date D;
try {
D = Sdf.parse ("Sun Feb 26 10:31:58 +0800 2012");
Long date = D.gettime ();
catch (ParseException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
The above writing, if not add the red part of the parameter, the conversion will be an error ~