日期:2014-05-20 浏览次数:20637 次
String endTime = "2010-10-14 00:41:58"; int seconds = 3661; 3661 等于 01:01:01 如何将字符串转化为 "2010-10-14 01:42:59"; 求方法!
try { DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = format.parse("2010-10-14 00:41:58"); Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.SECOND, 3661); String s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(c.getTime()); System.out.println(s); } catch (Exception e) { }