1、SimpleDateFormat将字符换转换为Date对象
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = format.parse("2011-01-01 00:00:00");
注意:
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")不能写成
new SimpleDateFormat("yyyy-MM-dd hh24:mi:ss")