In this section, you will learn to convert a date into string type. The java.util package provides the functionality to convert it.
Description of program:
This program helps you to convert the date into a string type. Firstly, you need to pass a date in the parse() method which is invoked through the DateFormat object . The format() method converts the date into a string. This method is defined as final in the DateFormat class. This is used to format a Date into a date/time string. The parameter passed is as date/time and it returns a string.
Here is the code of program:
Output of this program:
C:\date>java DateToString Today is 11-Jun-07
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.