Ad (728x90)

Filled Under:

Convert Date to String in Java

java
Please find below the code to change Date to String:
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);  }  
 
 }

Unknown

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment

Please write to us here...

 

We are featured contributor on entrepreneurship for many trusted business sites:

  • Copyright © Tekhnologia™ is a registered trademark.
    Designed by Templateism. Hosted on Blogger Templates.