import java.text.*;
import java.util.*;
public class DateToString {
public static void main(String[] args) {
try {
DateFormat formatter ;
Date date ;
formatter = new SimpleDateFormat("dd-MMM-yyyy");
date = (Date)formatter.parse("14-July-2011");
String s = formatter.format(date);
System.out.println("Date in String is : " + s);
} catch (ParseException e)
{System.out.println("Exception :"+e); }
}
}
Filled Under: java
Convert Date to String in Java
By
Unknown
Dated
Thursday, July 14, 2011
Please find below the code to change Date to String:
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Please write to us here...