To calculate the previous date, just do something like below, where the total number of previous days is multiplied by24 * 60 * 60 * 1000
new Date(System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000);
Where, 7 days are deducted from the current date.
Calculate the number of days on the service side and pass it as a parameter to the next line of code to get the required previous date.
Hope this helps.
source
share