Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As far as I understood your question, you can try to do something like that:</p> <pre><code>// this const is 24 hours in milliseconds: 24 hours in day, 60 min. in one hour, 60 sec. in one min., 1000 ms. in one sec. private static final int TWENTY_FOUR_HOURS = 24 * 60 * 60 * 1000; //... Date dateYouChose; Date dateYouChosePlus50Days = new Date(dateYouChose.getTime() + (50 * TWENTY_FOUR_HOURS)); </code></pre> <p><strong>Updated:</strong></p> <p>So, maybe it will be good for you (but be careful, I did not test this code, maybe I made a mistake in something):</p> <pre><code>final DatePicker datePicker; final Button btnDisplayCelebrationTimes; final TextView txtDatePlus50; final TextView txtDatePlus100; // ... btnDisplayCelebrationTimes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); final GregorianCalendar gregorianCalendar; gregorianCalendar = new GregorianCalendar(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); gregorianCalendar.add(Calendar.DAY_OF_MONTH, 50); final Date datePlus50 = gregorianCalendar.getTime(); txtDatePlus50.setText(dateFormat.format(datePlus50)); gregorianCalendar = new GregorianCalendar(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); gregorianCalendar.add(Calendar.DAY_OF_MONTH, 100); final Date datePlus100 = gregorianCalendar.getTime(); txtDatePlus100.setText(dateFormat.format(datePlus100)); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload