Possible Duplicate:
String to Date in Different Format in Java
I want to convert String to Date in different Format.
String d = "07:33:01 PM 26/11/2011";
How can i covert it to 26/11-19h30?
DateFormat formatter = new SimpleDateFormat("MM/dd-H\hm");
date = (Date)formatter.parse(d);
You will need to import java.util.* and import java.text.*
String d = "07:33:01 PM 26/11/2011";
Date date = new SimpleDateFormat("d/MM-HH\hmm", Locale.ENGLISH).parse(d);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With