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
Posted on: June 16, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles