用JAVA实现某个日期加一天

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

数据库中的记录的数据精确到秒,在页面选择某天,查不到数据,所以把某天的日期加一,查询两天之间的记录。下面为日期加一天的方法:

public static String addOneday(String today){  
        SimpleDateFormat f =  new SimpleDateFormat("yyyy-MM-dd");  
        try   {  
            Date  d  =  new Date(f.parse(today).getTime()+24*3600*1000);    
              return  f.format(d);  
        }  
        catch(Exception ex) {  
            return   "输入格式错误";    
        }  
    }

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/tyuuhgf/article/details/84025324