我在java中读过一个带有时间戳的csv文件。
String dat = "2016-11-29 12:05:55.0";
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");// "yyyy-MM-dd hh:mm:ss.SSS"
Date parsedDate = dateFormat.parse(dat);
Timestamp timestamp = new Timestamp(parsedDate.getTime());
时间戳现在是2016-11-29 00:05:55.0
我该如何改变?为什么00转换为12?
答案 0 :(得分:1)
查阅SimpleDateFormat的文档:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
您会发现position == arraylist.size() - 1;
是小时(0-23),HH
是小时(1-12)