JAVA 接口请求参数只保留时分秒

来源:互联网 发布:网络团购的流程 编辑:程序博客网 时间:2024/05/22 12:38

伪代码
String dateStr = new String(“2017-01-01 19:01:01”);
SimpleDateFormat format;
format = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
Date date;
try {
date = format.parse(dateStr);
format = new SimpleDateFormat(“HH:mm:ss”);
String time = format.format(date);
System.out.println(time);
} catch (ParseException e) {
e.printStackTrace();
}

结果
19:01:01

阅读全文
1 0
原创粉丝点击