I want to take today's date and change it to tomorrow's date. I will explain:
Today is the 14th of this month. I want to show tomorrow's number (15th) automatically. How can I do it?
I tried to convert string to integer and after that add 1 but i could not run the program....
package com.example.changetime;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView dateOne = findViewById(R.id.dateOne);
TextView dateTwo = findViewById(R.id.dateTwo);
String currentDate = new SimpleDateFormat("dd-MM-yy", Locale.getDefault()).format(new Date());
dateOne.setText(currentDate);
String currentDay = new SimpleDateFormat("dd", Locale.getDefault()).format(new Date());
dateTwo.setText(currentDay); //Here I want to show tomorrow's date
}
}
Thank you for the attention!