mirror of
https://github.com/gsantner/dandelion
synced 2024-11-21 20:02:07 +01:00
Fix getDateOfDaysAgo
This commit is contained in:
parent
194fbf6927
commit
3bc6afad03
1 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue