本文介紹了如何在不超過一個月的可用天數的情況下將 7 天添加到當前日期?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我正在嘗試獲取本月的今天.
I am trying to get todays day of the month.
我想做的是在數字上加上 7 天,然后得到當月的那一天.
And what i want to do is add seven days to the number and the get that current day of the month.
我還希望它能夠到下個月......讓我們說今天是 29 日.當它增加 7 天時,我怎樣才能讓它在下個月如 29 + 7 等于下個月的 5 號.
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.
我該怎么做呢?
我已經設法得到當前日期.
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();
我使用它是因為我想每 7 天在我的主要活動中啟動一個異步任務.
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);
來自 日歷 JavaDoc
這篇關于如何在不超過一個月的可用天數的情況下將 7 天添加到當前日期?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!