Datepublic Date(String s)
Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s).
Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse(java.lang.String) method.Parameters:s - a string representation of the date.See Also: DateFormat, parse(java.lang.String)
Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s).
Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse(java.lang.String) method.Parameters:s - a string representation of the date.See Also: DateFormat, parse(java.lang.String)
Date date=new Date(str);
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
String dateStr=format.format(date);
System.out.print(dateStr) ;去试试吧,美女!