java中间带T时间设置

 

java.util.Calendar startTime = null;
java.util.Calendar endTime = null;

String taskTime = "2020-12-16T00:00:55+08:00";

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:SSSXXX");

Date date = sdf.parse(taskTime);
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(date);

 

Date endDate =new java.util.Date();
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(endDate);
endTime = endCalendar;

 

posted @ 2020-12-17 15:28  金虹巴巴  阅读(3483)  评论(0编辑  收藏  举报