java以指定格式获取当前时间日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//2020-07-02这种格式
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 3);//获取当前日期的未来第三天的日期
Date date = calendar.getTime();
String expectDeliveryDate = sdf.format(date);//2020-07-05
Date date=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")//2020-07-02 11:16:10
还没有评论,来说两句吧...