SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");yyyy-MM-dd hh:mm:ss中只有MM(表示月)是大写,其他都是小写,否则会报Illegal pattern character 'Y'。 转载于:https://blog.51cto.com/6883741/1565538