我有一段程序,想把数据库中的一个字段date_due里的内容加上某个天数,然后写回数据库,我用的是
    java.util.Calendar aa = java.util.Calendar.getInstance();
    aa.setTime(date_due);
    aa.add(Calendar.DAY_OF_MONTH,10);
    aa.getTime();
但是我怎么把结果写到数据库里和aa.getTime()的返回值是什么类型?string ?

解决方案 »

  1.   

    java.sql.TYPES:static int TIME 
              The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIME. 
    static int TIMESTAMP 
              The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIMESTAMP. 
      

  2.   


    Calendar:
    getTime
    public final Date getTime()
    Gets this Calendar's current time. Returns:
    the current time.
      

  3.   

    我的语句这么写的有什么错误 ? 
       java.util.Calendar aa = java.util.Calendar.getInstance();
        aa.setTime(date_due);
        aa.add(Calendar.DATE,30); 
        Date date = aa.getTime();
        java.sql.Date temp=null;
        temp.setTime(date.getTime());
      

  4.   

    java.sql.Date date_due;//从数据库中取得值
      date_due.setTime(date_due.getTime() + 10 * 24 * 3600 * 1000);//10天换算成毫秒数
      //现在可以把date_due再送回数据库了