- public class Demo {
-
- public static void main(String[] args) throws Exception {
- String s = "2008-08-08 20:08:08";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date date = sdf.parse(s); // 把String转为Date, 解析
- System.out.println(date);
- }
- }
复制代码 |