I am have this String
from a Date
object: Mon Mar 25 00:00:00 IST 2013
What is the String
representation of the date format?
I am have this String
from a Date
object: Mon Mar 25 00:00:00 IST 2013
What is the String
representation of the date format?
The code below should work fine.
public static void main(String[] args) throws Exception {
String target = "Mon Mar 25 00:00:00 IST 2013";
DateFormat df = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy", Locale.ENGLISH);
Date result = df.parse(target);
System.out.println(result);
}
Read the javadoc for the valid patterns.
String yourDate= "Mon Mar 25 00:00:00 IST 2013" ;
DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
Date jDate = new Date(df.parse(yourDate).getTime());
System.out.println(jDate);