In this section, you will learn to convert the string value into a calendar.
Description of program:
The given example helps you, in converting the string value into a calendar through some Java methods and APIs. Your given date is taken as a string that is converted into a date type by using the parse() method. The parse() method invokes an object of DateFormat. The setTime(Date date) sets the formatted date into Calendar. This method invokes to Calendar object with the Date object.
Here is the code of progarm:
Output of this program:
C:\date>java StringToCalender Today is Mon Jun 11 00:00:00 GMT+05:30 2007M
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 16, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles