资 源 简 介
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)