SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Calendar c = Calendar.getInstance(); c.setTime(new Date()); // Using today's date c.add(Calendar.DATE, 5); // Adding 5 days String output = sdf.format(c.getTime()); System.out.println(output);
Related Posts:
- Java string to date conversion
- Change date format in a Java string
- How to compare dates in Java?
- Convert java.util.Date to String
- LocalDate to java.util.Date and vice versa simplest conversion?
- How to get today’s Date?
- How to convert currentTimeMillis to a date in Java?
- How to convert an Instant to a date format?
- Sort ArrayList of custom Objects by property
- Set Date in a single line
- How to determine day of week by passing specific date?
- How to convert a date to milliseconds
- Get integer value of the current year in Java
- How to convert java.util.Date to java.sql.Date?
- What does “Could not find or load main class” mean?
- Implementing UML diagram to Java [closed]
- Reading a plain text file in Java
- Converting double to string
- What is the “continue” keyword and how does it work in Java?
- Java String new line
- What does the protected modifier mean?
- Java default constructor
- What is the meaning of “this” in Java?
- ‘Java’ is not recognized as an internal or external command
- Java: Identifier expected
- How does Java’s PriorityQueue differ from a min-heap?
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Eclipse
- Converting double to integer in Java
- Difference between HashSet and HashMap?
- How to split a String by space
- Java compile error: “reached end of file while parsing }”
- Exception in thread “main” java.util.NoSuchElementException: No line found
- Java Method Call Expected
- Double % formatting question for printf in Java
- in java what does the @ symbol mean?
- How to call a method in another class in Java?
- unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- Java, “Variable name” cannot be resolved to a variable
- How to convert a Binary String to a base 10 integer in Java
- Using @RequestLine with Feign
- What is the best/simplest way to read in an XML file in Java application?
- Received fatal alert: handshake_failure through SSLHandshakeException
- DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704
- Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?
- HashSet vs. ArrayList
- FIFO based Queue implementations?
- How to import a .cer certificate into a java keystore?
- Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0 error in Java
- How can I represent a range in Java?
- How to solve error: ‘;’ expected in Java?
- Making a Java Makefile
- Censored Words Condition
- Android java.lang.IllegalStateException: Could not execute method of the activity
- Java error: Comparison method violates its general contract
- “Cannot create generic array of ..” – how to create an Array of Map
? - javac: file not found: first.java Usage: javac
- Eclipse Java error: This selection cannot be launched and there are no recent launches
- align text center with android
- hat is the purpose of flush() in Java streams?
- How can I convert integer into float in Java?
- How can I avoid this Ant Build error?
- Java Comparator class to sort arrays
- (The Triangle class) Design a class named Triangle that extends GeometricObject
- Cannot assign requested address using ServerSocket.socketBind
- Consider defining a bean of type ‘package’ in your configuration [Spring-Boot]
- Java – How to do floor division?
- Array Required, but java.lang.String found
- Eclipse java debugging: source not found
- IntelliJ – Can’t start – “JAVA_HOME does not point to a valid JVM installation”
- Empty an array in Java / processing
- Class is not Abstract and does not Override error in Java
- hibernate properties not found
- Make a simple timer in Java
- How to switch scenes in JavaFX
- Corrupt jar file
- java.util.IllegalFormatConversionException
- What do F and D mean at the end of numeric literals?
- Coding Conventions – Naming Enums
- Java better way to delete file if exists
- How to send HTTP request in java? [duplicate]
- Best way to represent a fraction in Java?
- java IO Exception: Stream Closed
- Can a normal Class implement multiple interfaces?
- What kind of Java type is “[B”?
- Hibernate – Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
- Node cannot be resolved to a type
- How to print the value of variable in java [duplicate]
- File to byte[] in Java
- Eclipse: JVM terminated. Exit code=2
- How to programmatically close a JFrame
- Playing .mp3 and .wav in Java?
- Difference between jar and war in Java
- Adding image to JFrame
- Mockito : doAnswer Vs thenReturn
- How Do I Implement an Insertion Sort Method for A Generic ArrayList?
- Troubleshooting “The type parameter T is hiding the type T” warning
- model.addAttribute() parameters
- StringFormat for Java Boolean Operator
- JOptionPane Yes or No window