I need to count back 90 days, 120 days and 160 days for a few items. How would I code this? I keep finding java code but that brings up errors when I am developing for android.
I need to take todays date and subtract the x amount of days and have it result be displayed on the screen nothing else. Thanks
You should use the Calendar
class :
//Calendar set to the current date
Calendar calendar=Calendar.getInstance();
//rollback 90 days
calendar.add(Calendar.DAY_OF_YEAR, -90);
//now the date is 90 days back
Log.i("MyApp","90 days ago:"+calendar.getTime().toString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With