计算日期间隔一直出错,大家帮忙看一下
<%@page contentType="text/html; charset=gb2312" import="java.sql.Date,java.text.DateFormat,java.util.*,java.io.*,java.text.*,java.sql.*,com.util.*,com.fredck.FCKeditor.*"%>
<%!
//计算日期间隔
int getDays(Date sd,Date ed){
return (ed.getTime()-sd.getTime())/(3600*24*1000);
}
%>
<%=getDays("2007-1-31","2007-1-11")%>
错误提示
An error occurred at line: 11 in the jsp file: /News/test.jsp
Generated servlet error:
C:\tomcat\work\Catalina\localhost\_\org\apache\jsp\News\test_jsp.java:22: possible loss of precision
found : long
required: int
return (ed.getTime()-sd.getTime())/(3600*24*1000);
^
An error occurred at line: 17 in the jsp file: /News/test.jsp
Generated servlet error:
C:\tomcat\work\Catalina\localhost\_\org\apache\jsp\News\test_jsp.java:69: getDays(java.sql.Date,java.sql.Date) in org.apache.jsp.News.test_jsp cannot be applied to (java.lang.String,java.lang.String)
out.print(getDays("2007-1-31","2007-1-11"));