How to convert complex date string into datetime java
I have the following string that I need put into a date time
Sat, 21-May-2011 21:31:35 GMT
So far I'm d开发者_开发百科oing the following but I'm not sure of the valid format to get this parsed. Any help would be appreciated!
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date date = df.parse("Sat, 21-May-2011 21:31:35 GMT");
Thank you in advance
See documentation for SimpleDateFormat
for format guidence
You should have something like this
SimpleDateFormat df = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss zzz");
精彩评论