1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-21 20:02:07 +01:00

Fix getDateOfDaysAgo

This commit is contained in:
Gregor Santner 2019-08-25 14:07:07 +02:00
parent 194fbf6927
commit 3bc6afad03
No known key found for this signature in database
GPG key ID: 7E83A7834AECB009

View file

@ -46,6 +46,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
@ -545,7 +546,9 @@ public class SharedPreferencesPropertyBackend implements PropertyBackend<String,
* Substract current datetime by given amount of days
*/
public Date getDateOfDaysAgo(int days) {
return new Date(System.currentTimeMillis() - days * 1000 * 60 * 60 * 24);
Calendar cal = new GregorianCalendar();
cal.add(Calendar.DAY_OF_MONTH, -days);
return cal.getTime();
}
/**