In this section, you will learn to convert the string value into a calendar.
Convert String to Calendar
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:
import java.util.*;
|
Output of this program:
C:\date>javac StringToCalender.java C:\date>java StringToCalender Today is Mon Jun 11 00:00:00 GMT+05:30 2007M |