如何添加7天当前的日期,而不会超过一个月的可用天数?一个月、天数、日期

由网友(生死豪情)分享简介:我试图让该月的今天一天。和我想要做的就是增加7天数和获得一个月,目前一天。此外,我希望它能够进入下一个month..Lets说今天是第29届。当它增加了7天,我该怎么去走接下来的一个月,如29 + 7就等于下个月的5日。如何,我会去这样做?香港专业教育学院已设法获取当前日期。日历CAL = Calendar.getIn...

我试图让该月的今天一天。

和我想要做的就是增加7天数和获得一个月,目前一天。

此外,我希望它能够进入下一个month..Lets说今天是第29届。当它增加了7天,我该怎么去走接下来的一个月,如29 + 7就等于下个月的5日。

如何,我会去这样做?

香港专业教育学院已设法获取当前日期。

 日历CAL = Calendar.getInstance();
    INT天= cal.get(Calendar.DAY_OF_MONTH);
    INT DAYOFMONTH =天;
    今天的String = getToday();
 

我使用的这个,因为我想推出一个AsyncTask的在我的主要活动,每7天。

解决方案

 添加(Calendar.DAY_OF_MONTH,7);
 
为什么我的电脑不能用俩条内存条啊 加多一条就不能开机了..是怎么回事..刚买到的时候能用..用了几天就不能用了..一样的频率也不能

从日历的JavaDoc

I am trying to get todays day of the month.

And what i want to do is add seven days to the number and the get that current day of the month.

Also i want it to be able to go to the next month..Lets say today is the 29th. When it adds 7 days how can i get it to go the the next month such as 29 + 7 would equal the 5th of the next month.

How would i go about doing this?

Ive already managed to get the current date.

Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DAY_OF_MONTH);
    int dayOfMonth = day;
    String today = getToday();

I am using this because i would like to launch an asynctask in my main activity every 7 days.

解决方案

add(Calendar.DAY_OF_MONTH, 7);

From Calendar JavaDoc

阅读全文

相关推荐

最新文章