当天+ N天未来一个月previous月的某一天 [英] current Day + N days is the day of next month or previous month

查看:150
本文介绍了当天+ N天未来一个月previous月的某一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ANDROID:

想知道是否有任何API或变通方法要知道,天X + N领先或落后天后的那一天将是/是下个月/ previous一个月。


解决方案

 公共静态日期getCurrentDatePlusDays(INT天){
        台历挂历= Calendar.getInstance();
        calendar.setTime(新的Date());
        calendar.add(Calendar.DAY_OF_YEAR,天);
        日期newDate = calendar.getTime();
        返回newDate;
    }

然后检查一个月或一年。

ANDROID:

Wanted to know whether is there any API or workaround to know that DAY X + N DAYS ahead or behind was the day that will be / was of next month / previous month.

解决方案

public static Date getCurrentDatePlusDays(int days) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_YEAR, days);
        Date newDate = calendar.getTime();
        return newDate;
    }

then check the month or year.

这篇关于当天+ N天未来一个月previous月的某一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆