我正在尝试在 AnnotatedTimeLine (Google Chart) 及其 req. 为日期时间格式。当我重新格式化(以时间戳格式)从班级收到的字符串时,它给了我这个:
2013-06-28 10:08:35.0
我想要做的是最后删除 .0 。我怎样才能做到这一点?代码如下所示:
public List<Survey> getAllSurvey(List<Status> statusList) {
String sqlValues = "SELECT * FROM status WHERE idCategory = (SELECT idCategory FROM category WHERE name = '"
+ statusList.get(0).getCategoryName() + "');";
List<Survey> survies = new ArrayList<Survey>();
try {
List<Map<String, Object>> rows = getJdbcTemplate().queryForList(
sqlValues);
for (Map row : rows) {
Survey survey = new Survey();
survey.setCategoryName(statusList.get(0).getCategoryName());
survey.setValue((String) (row.get("value")));
survey.setUnit((String) row.get("unit"));
survey.setTimestamp(row.get("timeStamp") + "");
survies.add(survey);
System.out.println(survey.toString());
}
} catch (BadSqlGrammarException e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println(sqlValues);
e.printStackTrace();
}
return survies;
}
提前致谢!