电子商务网站建设的参考文献,硬件开发平台是什么意思,用织梦做网站,北京免费做网站java中时间格式化怎么去时间间隔值关注:61 答案:2 mip版解决时间 2021-01-12 11:52提问者眼泪↓流到叻心里2021-01-11 20:30比如2015-02-03 13:25:55 与 2015-02-04 15:25:55 之间的时间间隔怎么获取最佳答案二级知识专家守給你的承諾2021-01-11 21:46转换成秒-相减取绝对值。…java中时间格式化怎么去时间间隔值关注:61 答案:2 mip版解决时间 2021-01-12 11:52提问者眼泪↓流到叻心里2021-01-11 20:30比如2015-02-03 13:25:55 与 2015-02-04 15:25:55 之间的时间间隔怎么获取最佳答案二级知识专家守給你的承諾2021-01-11 21:46转换成秒-相减取绝对值。public static long Date2timeStamp(String time) {String startDate time.split( )[0];String startTime time.split( )[1];Calendar nowDate Calendar.getInstance();long timeStamp 0;if (!startDate.equals()) {String[] s startDate.split(-);nowDate.set(Calendar.DAY_OF_MONTH, Integer.parseInt(s[2]));nowDate.set(Calendar.MONTH, Integer.parseInt(s[1]) - 1);nowDate.set(Calendar.YEAR, Integer.parseInt(s[0]));String[] t startTime.split(:);nowDate.set(Calendar.HOUR_OF_DAY, Integer.parseInt(t[0]));nowDate.set(Calendar.MINUTE, Integer.parseInt(t[1]));nowDate.set(Calendar.SECOND, Integer.parseInt(t[2]));timeStamp nowDate.getTimeInMillis() / 1000;}return timeStamp;}全部回答1楼抚弦思华年2021-01-11 23:21我试了 能运行的啊,输出:现在是: 22时16分43秒你是如何不能运行,报的什么错误信息?!!--------------------------------------------------这个format(string, object[])方法要求jdk1.5以上在eclipse查看 windows-preferences-java-installed jres如果你保证的你的jdk安装在1.5的话那就是eclipse的自动编译级别过低在windows-preferences-java-complier右边 jdk compliancecompiler compliance level: 选择 5.0改完会自动编译~ 再运行试试我要举报如以上问答内容为低俗/色情/暴力/不良/侵权的信息可以点下面链接进行举报我们会做出相应处理感谢你的支持→点此我要举报以上信息←推荐资讯大家都在看