import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateConversion { static Date getDate(String str) throws ParseException{ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); Date date = format.parse(str); return date; } public static void main(String args[]) throws ParseException{ String str = "2013-04-04 04:28:18.000"; Date date = getDate(str); System.out.println(date); } }
Output
Thu Apr 04 04:28:18 IST 2013
No comments:
Post a Comment