In this Tutorial we want to describe you a code that help you in understanding Get Tomorrow Date. For this we have a class name GetTomorrowDate.Inside the main method we have a variable name string s,Date date, Format formatter. The Calendar class has a method get Instance method() returns you the calendar object with a specific time zone and locale. . The calendar object call the get time () method that return you the current time and store in a variable date. and store in a formatter. The format class is abstract base class that is used for formatting the local sensitive object to a string. The formatter variable call format method to return a format object to a string.. The System.out.println print the current date. The calendar class has a add() method that add the next date in the calendar. In the same way the calendar call the get Time Method to return a current time and store in a date variable. The format method format the current time in a specified format passed as argument in simpledateformat and store in a string variable. Finally The println print the next day i.e. tomorrow on the command prompt.
1)calendar.getInstance ( )-This method return you the calendar object with a specific time zone and locale.
SimpleDateFormat- is a formatting concrete class that
helps you in parsing date in a locale-sensitive manner. This allows you to
format (date -> text), parsing (text -> date), and normalization.
3)calendar.getTime ( ) - This method returns the number of the millisecond elapsed since January1,1971.GetTomorrowDate.java
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Get Tomorrow Date
Post your Comment