Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  DateToString.java
Language: JAVA
Code:
import java.util.*; 
import java.text.*; 
import java.sql.Timestamp;
 
public class DateToString { 
public static void main(String args[]) { 
try { 
String str = "11/10/2012"; 
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); 
Date date = (Date)formatter.parse(str); 
long msec = date.getTime(); 
System.out.println("Date is " +date); 
System.out.println("MillSeconds is " +msec); 
} catch (ParseException e) 
{System.out.println("Exception :"+e); } 

}          
Comments: