pstmt = conn.prepareStatement("select ordernumber,datetime,price,dayofmoney from zujie where ordernumber= "+ cdName + " ")
rs=pstmt.executeQuery()
if(rs!=null && rs.next()){
String datetime = rs.getString(2)
java.text.SimpleDateFormat Formatter = new java.text.SimpleDateFormat ("yyyy-MM-dd")
Date date = new Date()
String date1=Formatter.format(date)
ParsePosition pos = new ParsePosition(0)
ParsePosition pos1 = new ParsePosition(0)
Date dt1=Formatter.parse(datetime,pos)
Date dt2=Formatter.parse(date1,pos1)
Long l = (dt2.getTime()-dt1.getTime())/(3600*24*1000)+1
double price = rs.getDouble(3)
double dayofmoney=rs.getDouble(4)
double dayofmoneybuy=dayofmoney*l
double otherMoney = price-dayofmoneybuy
request.setAttribute("price", price)
request.setAttribute("l", l)
request.setAttribute("dayofmoney", dayofmoneybuy)
request.setAttribute("otherMoney", otherMoney)
标签:
prepareStatement
ordernumber
dayofmoney
datetime
上传时间:
2013-12-14
上传用户:zsjinju