现在我用Timestamp类型取出了这个日期,
Timestamp tanupdate = (Timestamp)uInfo.getTanMstBean().getUpd_date();
想取出tanupdate 日期后30天的日期,
各位前辈们,请赐教~~

解决方案 »

  1.   


    tanupdate.setTime(tanupdate.getTime() + 1000 * 60 * 60 * 24 * 30);
      

  2.   


    int day = 30;
    tanupdate.setTime(tanupdate.getTime() + 1000 * 60 * 60 * 24 * day);
      

  3.   

    假如
    Timestamp tanupdate = (Timestamp)uInfo.getTanMstBean().getUpd_date(); 
    tanupdate 是数据库里就是null;
    到我的程序里就出错,
    null的时候怎么把它变成Timestamp的0呢?
      

  4.   


    int day = 30;
    if(tanupdate != null){
        tanupdate.setTime(tanupdate.getTime() + 1000 * 60 * 60 * 24 * day);
    } else {
        tanupdate.setTime(0);
    }setTime(0)的话,这个时间戳是标准时间的1970年1月1号00:00:00