Represents "next day" and "previous day" in Java / Android

From Android doc:

Consider a GregorianCalendar originally set to August 31, 1999. Calling add(Calendar.MONTH, 13) sets the calendar to September 30, 2000.

(Suppose you have a calendar set to August 31, 1999, so calling add (Calendar.MONTH, 13); will set that calendar to September 30, 2000.)

In other words Calendar calendar = Calendar.getInstance (); // Suppose this is set to 2017/5/31. calendar.add (Calendar.DATE, 1); // Since there is no date of 2017/5/32, it is automatically set to 2017/06/01. In the case of "yesterday" calendar.add (Calendar.DATE, -1); // Minus is subtraction

It can be expressed by intuitive addition and subtraction like this.

Recommended Posts

Represents "next day" and "previous day" in Java / Android
Java to C and C to Java in Android Studio
Difference between next () and nextLine () in Java Scanner
[Android / Java] Screen transition and return processing in fragments
Get the next business day after the specified date in JAVA
Try implementing Android Hilt in Java
Encoding and Decoding example in Java
StringBuffer and StringBuilder Class in Java
Hello world in Java and Gradle
[Android] Convert Map to JSON using GSON in Kotlin and Java
Difference between final and Immutable in Java
[Java] for Each and sorted in Lambda
Arrylist and linked list difference in java
Program PDF headers and footers in Java
Learn Flyweight patterns and ConcurrentHashMap in Java
Java Direction in C ++ Design and Evolution
Reading and writing gzip files in Java
Difference between int and Integer in Java
Discrimination of Enums in Java 7 and above
Impressions and doubts about using java for the first time in Android Studio
Regarding the transient modifier and serialization in Java
Create barcodes and QR codes in Java PDF
Detect similar videos in Java and OpenCV rev.2
Parallel and parallel processing in various languages (Java edition)
[Android / Java] Operate a local database in Room
Differences in writing Java, C # and Javascript classes
[Android] Alphabet uppercase limit and length limit in EditText
Capture and save from selenium installation in Java
Detect similar videos in Java and OpenCV rev.3
Add, read, and delete Excel comments in Java
Check static and public behavior in Java methods
[Java] Understand in 10 minutes! Associative array and HashMap
Basics of threads and Callable in Java [Beginner]
Distinguish between positive and negative numbers in Java
Java adds and removes watermarks in word documents
Questions in java exception handling throw and try-catch
Upload and download notes in java on S3
Encrypt / decrypt with AES256 in PHP and Java
Generate OffsetDateTime from Clock and LocalDateTime in Java
[Android development] Get an image from the server in Java and set it in ImageView! !!
[Android 9.0 Pie Java] Implement setOnTouchListener in the margin of RecyclerView and close the soft keyboard
Java learning day 5
Changes in Java 11
Java Day Tokyo 2017
Rock-paper-scissors in Java
Oracle Java Day 2017
Java and JavaScript
XXE and Java
Oracle Java Day 2017
FizzBuzz in Java
java learning day 2
java learning day 1
Convert JSON and YAML in Java (using Jackson and SnakeYAML)
Write ABNF in Java and pass the email address
It's late! Try implementing Android Notification in Java (Beginner)
Organize builds in C ++ / Java and Win / Linux combinations
Java beginners make poker games in 4 days (3rd day)
Vectorize and image MNIST handwritten digit image data in Java
Write a class in Kotlin and call it in Java
Asynchronous processing and Web API integration in Android Studio
Java classes and instances to understand in the figure